[docs] Py_SetPythonHome() before Py_Initialize()
twouters at google.com
Thu Jan 5 11:34:06 CET 2012
On Thu, Jan 5, 2012 at 05:30, Neal Norwitz <nnorwitz at google.com> wrote:
> +gps & twouters
> On Wed, Jan 4, 2012 at 6:02 PM, Cody Smith <cody at google.com> wrote:
>> Python folks,
>> Your "Initialization, Finalization, and Threads" document* explains
>> that embedded Python applications must call Py_Initialize() before any
>> other Python/C API functions, with a handful of exceptions. It seems
>> like Py_SetPythonHome() should be among the exceptions, but it isn't.
>> Initialization potentially relies on "home", so Py_SetPythonHome() is
>> useful before Py_Initialize(). This situation is similar to
>> Py_SetProgramName(), which _is_ permitted before Py_Initialize().
>> Also, in practice, the implementation of Py_SetPythonHome() only
>> accesses a single static global variable, "default_home". (This is
>> based on a spot check of 2.0.1, 2.6.7 and 3.2 branches).
>> Clarification would be much appreciated, since it might help me avoid
>> a hack. Thanks,
Not speaking for docs.python.org, but this is a bug in the documentation,
yes, and you should feel perfectly safe calling Py_SetPythonHome() before
Py_Initialize() -- it only makes sense to call it before Py_Initialize(),
after all. If it makes you feel any better I'll always guarantee the safety
of calling Py_SetPythonHome() before Py_Initialize() in *Google*'s Python
Thomas Wouters <twouters at google.com>
Hi! I'm a .signature virus! copy me into your .signature file to help me
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs