[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Eryk Sun
Eryk Sun added the comment: Can't there be a library named "libc" with the shared module "liblibc.so"? It seems to me that the _is_elf() function added in issue 41976 is breaking the contract that "[i]f no library can be found, returns None". It's not supposed to leak arbitrary exceptions

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread STINNER Victor
STINNER Victor added the comment: The documentation is explicit: you must not include the "lib" prefix. https://docs.python.org/dev/library/ctypes.html#ctypes.util.find_library See also examples: https://docs.python.org/dev/library/ctypes.html#finding-shared-libraries If it worked with "lib"

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Vadym Stupakov
Vadym Stupakov added the comment: I mean, find_library relies on gcc linker, when you pass library name to the linker, it automatically ads "lib" prefix to the library so, when you pass "libc", linker ads "lib" so u have an error with "liblibc" name. just man ld and see "-l" option: " -l

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Vadym Stupakov
Vadym Stupakov added the comment: > ctypes.util.find_library("libc") used to work in 3.8, not working in 3.9. As > I said before, ctypes.util.find_library("c") works in both 3.8 and 3.9. no, it doesn't work (and it shouldn't) neither in python 3.8 nor 3.7 Python 3.8.5 (default, Sep 4

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Eryk Sun
Eryk Sun added the comment: Issue 41976 added ctypes.util._is_elf() to filter out linker scripts such as "libc.so". The PR was backported to 3.7. _is_elf() assumes the trace result has absolute paths that can be opened, but Matthias is getting the relative filename "liblibc.a" in the

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Matthias Klose
Matthias Klose added the comment: ctypes.util.find_library("libc") used to work in 3.8, not working in 3.9. As I said before, ctypes.util.find_library("c") works in both 3.8 and 3.9. -- ___ Python tracker

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Vadym Stupakov
Vadym Stupakov added the comment: So, can we close it? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread STINNER Victor
STINNER Victor added the comment: Oh right, I always use find_library("c"), not find_library("libc"). -- ___ Python tracker ___

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Vadym Stupakov
Vadym Stupakov added the comment: Note, that adding "lib" prefix to any library is wrong, that's why it returns "None" or raises the exception. And it works fine when you call find_library("c") I guess the issue, that was reported here, is about raising and exception instead of returning

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread STINNER Victor
STINNER Victor added the comment: > _findLib_gcc() uses "gcc -Wl,-t -o tmp -lc" command and search for "lib" in > the created "tmp" file. Oh, it looks for the "lib" in the process stdout (not in the created "tmp" file). -- ___ Python tracker

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread STINNER Victor
STINNER Victor added the comment: This function is quite complicated on Linux: def find_library(name): # See issue #9998 return _findSoname_ldconfig(name) or \ _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread RedEyed
RedEyed added the comment: can't reproduce (py39) ➜ ~ ipython Python 3.9.1 (default, Dec 11 2020, 14:32:07) Type 'copyright', 'credits' or 'license' for more information IPython 7.20.0 -- An enhanced Interactive Python. Type '?' for help. In

[issue42580] ctypes.util.find_library("libc") fails

2021-02-13 Thread Alex Shpilkin
Change by Alex Shpilkin : -- nosy: +Alex Shpilkin ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42580] ctypes.util.find_library("libc") fails

2020-12-06 Thread Matthias Klose
Matthias Klose added the comment: ctypes.util.find_library("c") works in both 3.8 and 3.9 -- ___ Python tracker ___ ___

[issue42580] ctypes.util.find_library("libc") fails

2020-12-06 Thread Matthias Klose
New submission from Matthias Klose : regression compared to 3.8: $ python3.9 Python 3.9.1rc1 (default, Nov 27 2020, 19:38:39) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> ctypes.util.find_library("libc") Traceback (most recent call last):