Re: [RFA] ignore PYTHONHOME environment variable.

Joel Brobecker
2010-12-14T07:12:31Z

Hey Jan, Hey Doug,

I really apologize for the delay in getting back to this.

On Tue, Nov 23, 2010 at 09:30:54AM -0800, Joel Brobecker wrote:
> > <jan.kratochvil@redhat.com> wrote:
> > > But PYTHONHOME=$HOME for some user overrides of system Python would
> > > no longer work. Â What would $PYTHONHOME otherwise be useful for?
> >
> > OTOH what if one wanted to debug a python with a different PYTHONHOME?
> > GDB_PYTHONHOME? [not my idea, but seems reasonable]
>
> I think you indeed need something like that. I don't think we can trust
> PYTHONHOME, because it might point to something that's incompatible.

Jan: Does your objection still stand, or are you satisfied if we add
a GDB_PYTHONHOME environment variable to control the Python home?

Note that, if PYTHONHOME was used purely to access user scripts, then
they should be using PYTHONPATH instead.

> But I think I would prefer something like this:
>
> if "GDB_PYTHONHOME" is defined
> Py_SetPythonHome (getenv ("GDB_PYTHONHOME"));
> #ifdef WITH_PYTHON_PATH
> else
> /* 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
>
> The latter makes GDB_PYTHONHOME always active, regardless of how
> GDB was linked against Python.

Doug: Does this seem reasonable to you?

--
Joel