[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2020-03-25 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-37776: Test Py_Finalize() from a subinterpreter. -- ___ Python tracker ___ ___

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2020-03-20 Thread STINNER Victor
STINNER Victor added the comment: I changed my mind. I managed to implement bpo-39984 without needing my PR 19063, so I closed it. -- ___ Python tracker ___

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2020-03-18 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-36225: "Lingering subinterpreters should be implicitly cleared on shutdown". -- ___ Python tracker ___

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2020-03-18 Thread STINNER Victor
STINNER Victor added the comment: This issue became a blocker issue while working on bpo-39984, when I tried to move pending calls from _PyRuntimeState to PyInterpreterState. I wrote PR 19063 to deny calling Py_FinalizeEx() from a subinterpreter. Eric: > On the other hand, if the "main"

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2020-03-18 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +18417 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19063 ___ Python tracker ___

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2019-11-22 Thread Eric Snow
Eric Snow added the comment: I could swear the topic of destroy-everything-in-PyFinalize has come up before but I don't remember anything specific. Doing so there sure makes sense though... -- ___ Python tracker

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2019-11-22 Thread Eric Snow
Eric Snow added the comment: > * Is Python supposed to magically destroy the 3 interpreters? Doesn't it? Gah. I guess I was thinking of PyOS_AfterFork_Child(), which calls _PyInterpreterState_DeleteExceptMain(). :/ In September there was a nice comment right above Py_FinalizeEx() saying

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2019-11-22 Thread Eric Snow
Eric Snow added the comment: tl;dr Py_Finalize() probably *should* only be allowed under the main interpreter. As you know well, when the runtime starts we do it at first relative to a partially initialized main interpreter and the finish initialization with a fully operational main

[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2019-11-20 Thread STINNER Victor
New submission from STINNER Victor : Programs/_testembed.c contains the following test used by test_embed: static int test_audit_subinterpreter(void) { Py_IgnoreEnvironmentFlag = 0; PySys_AddAuditHook(_audit_subinterpreter_hook, NULL); _testembed_Py_Initialize();