Bug report
Bug description:
By inspecting the source code, I noticed that in the 3.12 branch handle is still used:
|
if handle is None: |
|
self._handle = _dlopen(self._name, mode) |
|
else: |
|
self._handle = handle |
but starting 3.13 & Unix-like systems it is not:
|
def _load_library(self, name, mode, handle, winmode): |
|
# If the filename that has been provided is an iOS/tvOS/watchOS |
|
# .fwork file, dereference the location to the true origin of the |
|
# binary. |
|
if name and name.endswith(".fwork"): |
|
with open(name) as f: |
|
name = _os.path.join( |
|
_os.path.dirname(_sys.executable), |
|
f.read().strip() |
|
) |
|
if _sys.platform.startswith("aix"): |
|
"""When the name contains ".a(" and ends with ")", |
|
e.g., "libFOO.a(libFOO.so)" - this is taken to be an |
|
archive(member) syntax for dlopen(), and the mode is adjusted. |
|
Otherwise, name is presented to dlopen() as a file argument. |
|
""" |
|
if name and name.endswith(")") and ".a(" in name: |
|
mode |= _os.RTLD_MEMBER | _os.RTLD_NOW |
|
self._name = name |
|
return _dlopen(name, mode) |
where
handle is passed to
CDLL._load_library() but is not used at all. Instead,
_dlopen() is always called to populate
self._handle.
A quick check shows that this starts fairly recently, Python 3.13.10+ & 3.14.1+. It seems to me like a refactoring bug introduced in #136878, #138546, #138547 IIUC.
CPython versions tested on:
3.13
Operating systems tested on:
No response
Linked PRs
Bug report
Bug description:
By inspecting the source code, I noticed that in the 3.12 branch
handleis still used:cpython/Lib/ctypes/__init__.py
Lines 378 to 381 in 2750f3c
but starting 3.13 & Unix-like systems it is not:
cpython/Lib/ctypes/__init__.py
Lines 382 to 401 in 823b50e
where
handleis passed toCDLL._load_library()but is not used at all. Instead,_dlopen()is always called to populateself._handle.A quick check shows that this starts fairly recently, Python 3.13.10+ & 3.14.1+. It seems to me like a refactoring bug introduced in #136878, #138546, #138547 IIUC.
CPython versions tested on:
3.13
Operating systems tested on:
No response
Linked PRs