[issue37224] test__xxsubinterpreters fails randomly
Eric Snow
report at bugs.python.org
Fri Dec 13 16:39:20 EST 2019
Eric Snow <ericsnowcurrently at gmail.com> added the comment:
On Sat, Nov 30, 2019 at 9:23 PM Kyle Stanley <report at bugs.python.org> wrote:
> Based on the above hint, I was able to make some progress on a potential solution. Thanks Eric.
That's great!
> Instead of only checking "frame->f_executing", I changed "_is_running()" to also check the
> "finalizing" field of PyInterpreterState. The "finalizing" field is set to 1 in "Py_EndInterpreter()",
> so this ensures that an interpreter in the process of being destroyed is considered "running",
> so that operations (such as running scripts, destroying the interpreter, etc) can't occur during
> finalization.
Ah, that makes sense.
> I had to add a private function to the C-API in order to access "interp->finalizing" from
> Modules/_xxsubinterpretersmodule.c due to the struct for PyInterpreterState being internal only.
Yep, it has to use the public C-API just like any other module. The
function has a "_Py" prefix and be defined in Include/cpython, right?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37224>
_______________________________________
More information about the Python-bugs-list
mailing list