On Sun, 1 Mar 2020 at 08:08, Victor Stinner vstinner@python.org wrote:
Le dim. 23 févr. 2020 à 15:06, Nick Coghlan ncoghlan@gmail.com a écrit :
P.S. An aspect of this that looks like it has potentially regressed since Python 3.6 is that whereas Py_NewInterpreter used to consistently print the exception and return NULL on failure [2], there are now several cases where we will instead generate an initialisation status code internally, and exit immediately [3] (even though the parent interpreter is presumably still in a valid state).
Py_NewInterpreter() still displays an error and returns NULL when it can.
Extract of Py_NewInterpreter() code of the master branch:
PyStatus status = new_interpreter(&tstate); if (_PyStatus_EXCEPTION(status)) { Py_ExitStatusException(status); }
Py_ExitStatusException() is only called when new_interpreter() fails to handle a regular Python exception. I added PyStatus at part of the PEP 587 implementation.
In Python 3.6, *many* helper function called by Py_NewInterpreter() called instead Py_FatalError()... which also exits immediately the process.
Ah, I didn't remember noticing this getting any worse in any of the PR reviews, and that's why - the subinterpreter setup was already prone to exiting immediately when "this should never fail" operations failed.
So the appearance of a regression was only the fact that when I read the code again now, it wasn't side-by-side with the old Py_FatalError code, so I forgot how it used to behave :)
Cheers, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia