Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] ignore PYTHONHOME environment variable.
@ 2010-11-23  1:03 Joel Brobecker
  2010-11-23  3:01 ` Jan Kratochvil
  0 siblings, 1 reply; 19+ messages in thread
From: Joel Brobecker @ 2010-11-23  1:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

This is something I hinted during one of our discussion at this year's
GCC Summit.

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.

gdb/ChangeLog:

        * 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
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -955,6 +955,12 @@ Enables or disables printing of Python stack traces."),
   Py_Initialize ();
   PyEval_InitThreads ();
 
+#ifdef WITH_PYTHON_PATH
+  /* 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));
+#endif
+
   gdb_module = Py_InitModule ("gdb", GdbMethods);
 
   /* The casts to (char*) are for python 2.4.  */
-- 
1.7.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-05-30 14:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23  1:03 [RFA] ignore PYTHONHOME environment variable Joel Brobecker
2010-11-23  3:01 ` Jan Kratochvil
2010-11-23  9:29   ` Doug Evans
2010-11-23 16:31     ` Jan Kratochvil
2010-11-23 16:57       ` Doug Evans
2010-11-23 17:31         ` Joel Brobecker
2010-12-14  7:12           ` Joel Brobecker
2010-12-14  9:27             ` Jan Kratochvil
2010-12-14 10:33               ` Joel Brobecker
2011-01-13 22:57                 ` Joel Brobecker
2011-01-15  9:17                   ` Doug Evans
2011-01-15 11:26                     ` Jan Kratochvil
2011-01-17 10:36                       ` Joel Brobecker
2012-05-18 19:34                 ` Jan Kratochvil
2012-05-28 14:41                   ` Joel Brobecker
2012-05-28 17:30                     ` Jan Kratochvil
2012-05-29 14:54                       ` Joel Brobecker
2012-05-29 15:57                         ` Jan Kratochvil
2012-05-30 14:37                         ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox