[docs] [issue33932] Calling Py_Initialize() twice now triggers a fatal error (Python 3.7)

Nick Coghlan report at bugs.python.org
Wed Jun 27 09:52:30 EDT 2018


Nick Coghlan <ncoghlan at gmail.com> added the comment:

https://github.com/python/cpython/pull/7967 amends the docs and adds the deprecation notices, but after taking another look at the way Victor's patch works, I'm thinking we may not need them: the *new* initialization API remains strict about the required state machine transitions, which means that calling `Py_Initialize` when only the core has been initialized will fail at the _Py_InitializeCore step (as that complains if the core has already been initialized).

Similarly, calling _Py_InitializeCore after Py_Initialize still fails, as the *only* case that becomes a no-op is specifically Py_InitializeEx, *after* the interpreter is fully initialized.

Given that, I think we can just keep Victor's compatibility fix indefinitely, and only have the new incremental initialization APIs be strict about the expected transitions through the state machine.

----------

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


More information about the docs mailing list