This is the mail archive of the
mailing list for the GDB project.
[RFA] ignore PYTHONHOME environment variable.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: Joel Brobecker <brobecker at adacore dot com>
- Date: Mon, 22 Nov 2010 17:03:22 -0800
- Subject: [RFA] ignore PYTHONHOME environment variable.
This is something I hinted during one of our discussion at this year's
If PYTHONHOME is defined in the environment, then Py_SetProgramName
does not use the program-name location to find the python library.
Instead, it follows the PYTHONHOME, which can cause problems if
it points to a different Python installation, particularly if that
installation is from a different version of Python.
* python/python.c (_initialize_python): Call Py_SetPythonHome
if GDB was configured with --with-python.
Tested on x86_64-linux. Ok to commit?
gdb/python/python.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/gdb/python/python.c b/gdb/python/python.c
index d009be9..4f6f679 100644
@@ -955,6 +955,12 @@ Enables or disables printing of Python stack traces."),
+ /* We override any value that the PYTHONHOME might have, as we want
+ to make sure that we use the Python library that comes with GDB. */
+ Py_SetPythonHome (ldirname (python_libdir));
gdb_module = Py_InitModule ("gdb", GdbMethods);
/* The casts to (char*) are for python 2.4. */