> 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?
Yeah, I named it "_PyInterpreterIsFinalizing" and it's within Include/cpython. Definitely open to suggestions on the name though, it's basically just a private getter for interp->finalizing.
> We don't need everything to be fixed in a single PR. Feel free to
> create a PR just for the "finalizing" fix.
Oh, awesome! In that case, I'll do some more rigorous testing before opening the PR then; I'd like to be 99.99% certain that it at least resolves the following failure:
FAIL: test_still_running (test.test__xxsubinterpreters.DestroyTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test__xxsubinterpreters.py", line 765, in test_still_running
interpreters.destroy(interp)
AssertionError: RuntimeError not raised
Especially since it would be adding a new private C-API function, who's primary purpose is to address this specific failure.
This might be a bit of a time consuming process, but I should have time in the next week or so to work on it.