Content-Length: 293340 | pFad | http://github.com/python/cpython/pull/136878/commits/06df0965d9c646d0d36d47349f3ef9f36e890789

80 gh-83424: Allow empty name if handle is non-null when create ctypes.CDLL by aisk · Pull Request #136878 · python/cpython · GitHub
Skip to content

gh-83424: Allow empty name if handle is non-null when create ctypes.CDLL #136878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Ensure self._name is set
  • Loading branch information
aisk committed Jul 20, 2025
commit 06df0965d9c646d0d36d47349f3ef9f36e890789
11 changes: 5 additions & 6 deletions Lib/ctypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,10 @@ class _FuncPtr(_CFuncPtr):
if name:
name = _os.fspath(name)

if handle is None:
self._handle = self._load_library(name, mode, winmode)
else:
self._handle = handle
self._handle = self._load_library(name, mode, handle, winmode)

if _os.name == "nt":
def _load_library(self, name, mode, winmode):
def _load_library(self, name, mode, handle, winmode):
if winmode is not None:
mode = winmode
else:
Expand All @@ -443,10 +440,12 @@ def _load_library(self, name, mode, winmode):
name = _nt._getfullpathname(name)
mode |= _nt._LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
self._name = name
if handle is not None:
return handle
return _LoadLibrary(self._name, mode)

else:
def _load_library(self, name, mode, winmode):
def _load_library(self, name, mode, handle, winmode):
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
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/136878/commits/06df0965d9c646d0d36d47349f3ef9f36e890789

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy