Message387110
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 result. Whatever the reason, I think if the file can't be opened for reading, then _is_elf() should just return False. For example:
def _is_elf(filename):
"Return True if the given file is an ELF file"
elf_header = b'\x7fELF'
try:
with open(filename, 'br') as thefile:
return thefile.read(4) == elf_header
except OSError:
return False |
|
Date |
User |
Action |
Args |
2021-02-16 13:35:22 | eryksun | set | recipients:
+ eryksun, doko, vstinner, Alex Shpilkin, RedEyed |
2021-02-16 13:35:22 | eryksun | set | messageid: <1613482522.69.0.163127216497.issue42580@roundup.psfhosted.org> |
2021-02-16 13:35:22 | eryksun | link | issue42580 messages |
2021-02-16 13:35:22 | eryksun | create | |
|