This is the mail archive of the mailing 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]

Re: [RFA] ignore PYTHONHOME environment variable.

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.


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
	$ PYTHONHOME=/foo ./gdb
	ImportError: No module named site

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

	# installing zipimport hook
	import zipimport # builtin
	import gdb.command.upto # precompiled from /usr/share/gdb/python/gdb/command/upto.pyc
	GNU gdb (GDB)


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