This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix loading system libraries with ctypes on macOS Big Sur.
On Big Sur, there is no longer a separate dylib file for each system library. Instead, they have been combined into a single shared cache file. As a result, it no longer suffices to check file existence to determine whether a system library is present. Fix this by calling _dyld_shared_cache_contains_path to check the dyld shared cache as well. The changes under lib-python/ are copied from python/cpython#22855. The _dyld_shared_cache_contains_path function is exposed to the ctypes python code using CFFI, similar to what is done in other modules, such as lib_pypy/_sha3. Fixes issue #3314.
- Loading branch information
Showing
5 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import platform | ||
|
||
from cffi import FFI | ||
ffi = FFI() | ||
|
||
def main(): | ||
if platform.system() != 'Darwin': | ||
return | ||
|
||
release, _, _ = platform.mac_ver() | ||
release = tuple(map(int, release.split('.'))) | ||
if release < (10, 16): | ||
return | ||
|
||
ffi.cdef('bool _dyld_shared_cache_contains_path(const char* path);') | ||
ffi.set_source('_ctypes_cffi', '#include <mach-o/dyld.h>') | ||
|
||
os.chdir(os.path.dirname(__file__)) | ||
ffi.compile() | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters