Author eryksun
Recipients Alex Shpilkin, RedEyed, doko, eryksun, vstinner
Date 2021-02-16.13:35:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613482522.69.0.163127216497.issue42580@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-02-16 13:35:22eryksunsetrecipients: + eryksun, doko, vstinner, Alex Shpilkin, RedEyed
2021-02-16 13:35:22eryksunsetmessageid: <1613482522.69.0.163127216497.issue42580@roundup.psfhosted.org>
2021-02-16 13:35:22eryksunlinkissue42580 messages
2021-02-16 13:35:22eryksuncreate