Repository navigation
gh-162362: Resolve dyld functions from the process on import ctypes.util on macOS - #162363
Conversation
|
!buildbot macOS |
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit e3cba4d 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F162363%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
vstinner
left a comment
There was a problem hiding this comment.
LGTM.
I don't have access to macOS, so I cannot test this change manually. But if _libc["_dyld_get_image_name"] still works when using ctypes.CDLL(None), I think that it's safer and more reliable to use ctypes.CDLL(None).
I see that ctypes.util.dllist() is tested by Lib/test/test_ctypes/test_dllist.py. So if test_ctypes pass on GHA macOS and macOS buildbots, we are good :-)
|
Thanks @maurycy for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
GH-162899 is a backport of this pull request to the 3.15 branch. |
|
GH-162900 is a backport of this pull request to the 3.14 branch. |
Use
CDLL(None)to look up_dyld_image_countand_dyld_get_image_name. Both symbols are already available in the process. This removes the import-time search for libc, which could load a library from the working directory on macOS.Fixes #162362
import ctypes.utilon macOS loads a library from the working directory #162362