SIGN IN SIGN UP

gh-117303: Don't detach in `PyThreadState_DeleteCurrent()` (#117304)

This fixes a crash in `test_threading.test_reinit_tls_after_fork()` when
running with the GIL disabled. We already properly handle the case where
the thread state is `_Py_THREAD_ATTACHED` in `tstate_delete_common()` --
we just need to remove an assertion.

Keeping the thread attached means that a stop-the-world pause, such as
for a `fork()`, won't commence until we remove our thread state from the
interpreter's linked list. This prevents a crash when the child process
tries to clean up the dead thread states.
S
Sam Gross committed
bfc57d43d8766120ba0c8f3f6d7b2ac681a81d8a
Parent: 05e0b67
Committed by GitHub <noreply@github.com> on 3/29/2024, 10:58:08 PM