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
[ctypes
][linux
] ctypes.util.find_library()
crash instead of return None
#114257
Comments
cc @manopapad |
Full output with some prints (python pulled from conda-forge):
I assume the double "lib" is intentional, and this call was meant to fail, and just ended up mis-parsing an unrelated part of the output diagnostic message. |
The In the new version of gcc, it will display a recommendation tip in case you add the unnecessary
If a matching result, such as I'm not sure if any other |
…() (pythonGH-114394) (cherry picked from commit 7fc51c3) Co-authored-by: AN Long <aisk@users.noreply.github.com>
…() (pythonGH-114394) (cherry picked from commit 7fc51c3) Co-authored-by: AN Long <aisk@users.noreply.github.com>
Bug report
Bug description:
The problem:
ctypes.util.find_library()
raises an exception on certain inputs when it cannot find it.Expected behavior:
No exception, return
None
as advertised if it cannot find the library.Reproducer:
Note that the crash does not occur if you put nonsense in:
find_library('asdadsas')
-> OKfind_library('libasdasdasd')
-> OKThe problem appears to be a bit more contrived. Python is attempting to parse the output from gcc, which in this case is:
But then the parser is getting confused trying to parse the useful diagnostic message mentioning
libgomp.a
.Machine details (from
platform.uname()
)CPython versions tested on:
3.10, 3.11, 3.12
Operating systems tested on:
Linux
Linked PRs
FileNotFound
error inctypes.util._is_elf
#114394The text was updated successfully, but these errors were encountered: