gh-130522: Fix unraisable TypeError in threading at interpreter shutdown (#131537)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
Tyler Kennedy 2025-07-25 10:51:30 -04:00 committed by GitHub
parent 7ce2f101c4
commit cb93b6fc5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 1 deletions

View file

@ -1414,7 +1414,7 @@ def __init__(self, dummy_thread):
# the related _DummyThread will be kept forever!
_thread_local_info._track_dummy_thread_ref = self
def __del__(self):
def __del__(self, _active_limbo_lock=_active_limbo_lock, _active=_active):
with _active_limbo_lock:
if _active.get(self._tident) is self._dummy_thread:
_active.pop(self._tident, None)