Closed as duplicate of#124619
Closed as duplicate of#124619
Description
Bug description:
I'm writing PyO3/pyo3#4874, which tries to avoid Rust crashing on Python interpreter termination when there are native threads attempting to acquire the GIL.
To test it, I created a test that constantly hammers the GIL on a daemon thread, and on debug builds, I get this assertion failure fairly reliably on Python 3.13:
Python/pystate.c:345: void unbind_gilstate_tstate(PyThreadState *): Assertion `tstate == tstate_tss_get(&(tstate->interp->runtime)->autoTSSkey)' failed
It looks like zapthreads
is attempting to zap a native thread that does not currently hold the GIL.
Would it help if I'll reproduce this in a C example?
CPython versions tested on:
3.13
Operating systems tested on:
Linux