-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Handle dlopen(NULL) failure in glibc fallback #12716
Merged
Merged
Conversation
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
charliermarsh
force-pushed
the
charlie/cdll
branch
from
May 20, 2024 19:15
daddc6e
to
2f13f99
Compare
charliermarsh
commented
May 20, 2024
@@ -50,7 +63,7 @@ def glibc_version_string_ctypes() -> Optional[str]: | |||
|
|||
# Call gnu_get_libc_version, which returns a string like "2.5" | |||
gnu_get_libc_version.restype = ctypes.c_char_p | |||
version_str = gnu_get_libc_version() | |||
version_str: str = gnu_get_libc_version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied over the full _glibc_version_string_ctypes
from _manylinux.py
, and this was the only other change. I can back it out if desired.
This was referenced May 20, 2024
uranusjr
approved these changes
May 20, 2024
ichard26
reviewed
Jul 4, 2024
Co-authored-by: Richard Si <sichard26@gmail.com>
Thanks @charliermarsh! |
jsirois
pushed a commit
to pex-tool/pip
that referenced
this pull request
Jul 23, 2024
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
jsirois
added a commit
to pex-tool/pex
that referenced
this pull request
Jul 24, 2024
This pulls in a new vendored version of Pip with the recent fix in pypa/pip#12716 applied in pex-tool/pip#13. As a result, Pex can run using vendored Pip under statically linked musl libc CPython interpreters. This opens the door to bootstrapping newer unpatched Pip's that also have this same fix (versions 24.2 and later; see: #2471). Fixes #2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR applies the same exception handling to
ctypes.CDLL(None)
that already exists for the analogous method in packaging: pypa/packaging#294 (and, similarly, in pip's vendored packaging -- seesrc/pip/_vendor/packaging/_manylinux.py
).The basic idea is that if you're using a Python distribution built against musl libc,
dlopen
will fail (in addition toimport ctypes
itself failing).Also relevant is indygreg@5139dc4 and #6543, where @indeygreg added the original
try
-except
forctypes.