SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

72137 0 36 Python

gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805)

Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
J
Jeremy Maitin-Shepard committed
8cc5aa47ee464ddfd8da5461edecf4a5c72df2ff
Parent: 113b2d7
Committed by GitHub <noreply@github.com> on 10/2/2024, 4:17:49 PM