Jan Kratochvil - Re: [RFA] ignore PYTHONHOME environment variable. (original) (raw)

This is the mail archive of the gdb-patches@sourceware.orgmailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

On Tue, 14 Dec 2010 11:33:05 +0100, Joel Brobecker wrote:

What we can also do is warn users when we see that PYTHONHOME is defined and not GDB_PYTHON_HOME. That way, they are not surprised when that happens, and they get a helpful indication of how to remedy the problem.

Therefore:

if ($GDB_PYTHONHOME exists) { use it } else if ($PYTHONHOME exists) { warn on it ignore it pass it to spawned debuggees } else { let Python use it's defaults }

That "ignore it" part may be difficult as despite Py_SetPythonHome overrides $PYTHONHOME if !defined WITH_PYTHON_PATH we do not know which string to use for Py_SetPythonHome to override it. So maybe to use unsetenv before Py_Initialize and setenv the saved string back afterwards.

Also I believe it should apply to any environment starting with PYTHON* as besides $ PYTHONHOME=/foo ./gdb ImportError: No module named site

it affects also at least $ echo foo >site.py; PYTHONPATH=. ./gdb Traceback (most recent call last): File "./site.py", line 1, in foo NameError: name 'foo' is not defined

and $ PYTHONVERBOSE=1 ./gdb # installing zipimport hook import zipimport # builtin [...] import gdb.command.upto # precompiled from /usr/share/gdb/python/gdb/command/upto.pyc GNU gdb (GDB) 7.4.50.20120512-cvs [...]

Thanks, Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]