[issue34008] Do we support calling Py_Main() after Py_Initialize()?

STINNER Victor report at bugs.python.org
Fri Jul 20 09:38:13 EDT 2018


STINNER Victor <vstinner at redhat.com> added the comment:

I looked one more time at Python 3.6, code before my huge Py_Main()/Py_Initialize() refactoring, before _PyCoreConfig/_PyMainInterpreterConfig have been added. In short, calling Py_Main() after Py_Initialize() "works" in Python 3.6 but only sys.argv is set: almost all other options are lost/ignored. For example, if you call Py_Initialize() you get a sys.path from the current environment, but if Py_Main() gets a new module search path: sys.path is not updated.

I modified PR 8043 to write the minimum patch just to fix fontforge. When Py_Main() is called Py_Initialize(): just set sys.argv, that's all.

If someone wants to fix this use case, apply properly the new Py_Main() configuration carefully, I would suggest to only work in the master branch: that's out of the scope of this specific regression.

IMHO it would be nice to enhance this use case. For example, it would be "nice" to update at least "sys.path" (and other related variables) in such case.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34008>
_______________________________________


More information about the Python-bugs-list mailing list