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 jankratochvil
Recipients dmalcolm, jankratochvil
Date 2012-05-29.19:56:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
People use custom Python builds setting PYTHONHOME and PYTHONPATH to these custom builds. This may be expected to break running system Python binary but it also unexpectedly breaks various applications which also embed Python:

$ echo foo >; export PYTHONPATH=.
$ gdb
Traceback (most recent call last):
  File "./", line 1, in <module>
NameError: name 'foo' is not defined
$ _

It is not obvious to the user who even already forgot about custom PYTHONPATH why GDB breaks.

Standard Fedora applications may link with system libpython incompatible with the PYTHONHOME/PYTHONPATH files for the other Python version. Python does not keep the scripts too compatible across Python versions.

This issues was discussed first for GDB upstream:
[RFA] ignore PYTHONHOME environment variable.
(first mail of the thread in each month)
Then also in Fedora:
This Python issue would not be filed by the user if it gets resolved:

Exactly the same problem exists for many other apps, yum for all

$ echo foo >; PYTHONPATH=. yum list bash
Traceback (most recent call last):
  File "./", line 1, in <module>
NameError: name 'foo' is not defined
$ _

Various proposal have been, applicable possibly in some combination together:

 * Ignore PYTHONHOME/PYTHONPATH for embedded applications. (dot)
 * Ignore PYTHONHOME, use only GDB_PYTHONHOME (if set). This proposal is not applicable for all applications in general.
 * Print warning if PYTHONHOME/PYTHONPATH is set.
 * Recover from Python startup failure and suppress the environment vars.
   or Recover from Python startup failure and disable the Python support, if possible.
 * Should the special care affect PYTHONHOME? Differently for PYTHONPATH? What about PYTHONVERBOSE and other PYTHON* settings? 

How should get PYTHONHOME/PYTHONPATH inherited into child processes, if any (debuggees in the GDB case).

Another question is whether the behavior should be the same if upstream application has been linked with non-system libpython location.
Date User Action Args
2012-05-29 19:56:52jankratochvilsetrecipients: + jankratochvil, dmalcolm
2012-05-29 19:56:52jankratochvilsetmessageid: <>
2012-05-29 19:56:51jankratochvillinkissue14956 messages
2012-05-29 19:56:51jankratochvilcreate