This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ned.deily
Recipients ned.deily, ronaldoussoren
Date 2012-08-22.08:21:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345623707.33.0.86377230375.issue15761@psf.upfronthosting.co.za>
In-reply-to
Content
Setting the environment variable PYTHONEXECUTABLE can cause the interpreter to crash with a segfault or to otherwise fail during initialization.  Another manifestation is the failure of test test_osx_env with:

AssertionError: -10 != 2 : expected PYTHONEXECUTABLE == sys.executable

(-10 means the interpreter subprocess under test segfaulted)

I have not yet been able to identify the root cause or the minimum set of conditions to produce a crash.  So far it seems that the interpreter must be 32-bit and running on 10.6 or later.  In all of the failures I've seen, PYTHONEXECUTABLE was set to an absolute path, not necessarily a valid path.  When running a debug build, I've seen two failure modes:

Assertion failed: (value), function PyDict_SetItem, file 
Objects/dictobject.c, line 1197.

#0  0x942a9332 in __kill ()
#1  0x942a8932 in kill$UNIX2003 ()
#2  0x98563c0c in abort ()
#3  0x9859820b in __assert_rtn ()
#4  0x00091b0f in PyDict_SetItem (op=0x48f438, key=0x487610, value=0x0) at Objects/dictobject.c:1197
#5  0x0009669d in PyDict_SetItemString (v=0x48f438, key=0x30ccfd "version", item=0x0) at Objects/dictobject.c:2695
#6  0x00245616 in make_impl_info (version_info=0x0) at ./Python/sysmodule.c:1525
#7  0x00244a00 in _PySys_Init () at ./Python/sysmodule.c:1690
#8  0x0022fdc1 in _Py_InitializeEx_Private (install_sigs=1, install_importlib=1) at Python/pythonrun.c:334
#9  0x00231577 in Py_InitializeEx (install_sigs=1) at Python/pythonrun.c:401
#10 0x0023159a in Py_Initialize () at Python/pythonrun.c:407
#11 0x00269138 in Py_Main (argc=3, argv=0x446028) at Modules/main.c:646


Also:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'

#0  0x942a9332 in __kill ()
#1  0x942a8932 in kill$UNIX2003 ()
#2  0x98563c0c in abort ()
#3  0x001a8d09 in Py_FatalError (
    msg=0x2506d4 "Py_Initialize: unable to load the file system codec")
    at Python/pythonrun.c:2358
#4  0x001a3320 in _Py_InitializeEx_Private (install_sigs=1, install_importlib=1)
    at Python/pythonrun.c:374
#5  0x001a3442 in Py_InitializeEx (install_sigs=1) at Python/pythonrun.c:401
#6  0x001a3456 in Py_Initialize () at Python/pythonrun.c:407
#7  0x001cd0f2 in Py_Main (argc=1, argv=0x394028) at Modules/main.c:646
#8  0x000025e7 in main (argc=1, argv=0xbffff994) at python.c:66

Inspecting and gdb stepping through main.c, getpath.c, and pythonrun.c has not uncovered anything obvious yet.  Note, there have been changes in these areas for 3.3 in support of venv and bug fixes.

PYTHONEXECUTABLE is a somewhat vestigial environment variable supported only on OS X.  AFAIK, it was only intended for used with the deprecated bundlebuilder.py tool but it is externally documented; it's also still used by IDLE.app initialization which is based on bundlebuilder.  So it might not be a release blocker to fix immediately but it is disquieting.  As there are other higher priority issues at the moment, I probably won't be able to get back to this until after rc1.
History
Date User Action Args
2012-08-22 08:21:47ned.deilysetrecipients: + ned.deily, ronaldoussoren
2012-08-22 08:21:47ned.deilysetmessageid: <1345623707.33.0.86377230375.issue15761@psf.upfronthosting.co.za>
2012-08-22 08:21:46ned.deilylinkissue15761 messages
2012-08-22 08:21:45ned.deilycreate