Python 2.7 segfaults on 'import site'

Chris Angelico rosuav at gmail.com
Tue Dec 30 02:02:21 EST 2014


On Tue, Dec 30, 2014 at 5:34 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Mon, Dec 29, 2014 at 7:05 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> Are .pyc files compatible across revisions? Could I carry this file to
>> a 2.7.9 and see if the crash still happens?
>
> PEP 6 requires that .pyc files for a particular major release must
> work with all the bug fix releases for that version.

Cool. I've tried it on a 2.7.8 (the most recent that I have handy),
and it still crashed, though I haven't yet grabbed a 2.7.9.

Using uncompyle, I compared the two files. They're identical after
decompilation but for one line:

# Original file:
def parse(str, flags=0, pattern=None):
# Working pyc, decompiled:
def parse(str, flags = 0, pattern = None):
# Broken pyc, decompiled:
def parse(str, flags, pattern, source, p = 0, tail = None):

So once again, I have some information... and another "Huh?". The
names source, p, and tail are the other local names used in that
function, so it seems that somehow the number of arguments has become
corrupted... in an otherwise-perfect file. The files are nearly
identical, but it's not a simple corruption; there's a byte inserted
at one point and deleted at another. This doesn't look like a failing
hard drive, but I don't know what it *does* look like.

ChrisA



More information about the Python-list mailing list