[docs] Py_SetPythonHome() before Py_Initialize()

Neal Norwitz nnorwitz at google.com
Thu Jan 5 05:30:45 CET 2012


+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,
>
> Cody
>
> * = http://docs.python.org/c-api/init.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20120104/c7e6119b/attachment.html>


More information about the docs mailing list