Python 2.7 segfaults on 'import site'

Chris Angelico rosuav at gmail.com
Mon Dec 29 11:28:23 EST 2014


On Tue, Dec 30, 2014 at 3:05 AM, Irmen de Jong <irmen.NOSPAM at xs4all.nl> wrote:
> On 29-12-2014 15:33, Chris Angelico wrote:
>
>> So clearly an empty 'site' can be imported safely, but running Python
>> without -S segfaults.
>>
>> Can anyone advise as to where I should look for the cause of the trouble?
>>
>> ChrisA
>
> Perhaps starting python with -v provides some more info on when exactly it is crashing
> during the startup process. (i.e. is it really site.py that crashes it?)

*facepalm* Yeah, that's the one I didn't think of. But now I have an
even bigger question.

...
...
...
# /usr/lib/python2.7/sre_constants.pyc matches
/usr/lib/python2.7/sre_constants.py
import sre_constants # precompiled from /usr/lib/python2.7/sre_constants.pyc
Segmentation fault

Why is sre_constants segfaulting?! It's such a simple file! I assume
the "matches" comment means it thinks there's no problem with the .pyc
file; is it possible that, despite those checks, there's an issue
there? I could delete the .pyc and try again, but I'm scared that'll
fix the problem and leave me unable to figure out the true cause :)

ChrisA



More information about the Python-list mailing list