From d32b7fca36c4a5e59de07899dd29ed88388ed65c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 15 Jun 2021 18:31:54 +0200 Subject: [PATCH] bpo-44422: threading.Thread reuses the _delete() method The _bootstrap_inner() method of threading.Thread now reuses its _delete() method rather than accessing _active() directly. It became possible since _active_limbo_lock became reentrant. Moreover, it no longer ignores any exception when deleting the thread from the _active dictionary. --- Lib/threading.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Lib/threading.py b/Lib/threading.py index 766011fa0312b3..c2b94a5045514f 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -1010,13 +1010,7 @@ def _bootstrap_inner(self): except: self._invoke_excepthook(self) finally: - with _active_limbo_lock: - try: - # We don't call self._delete() because it also - # grabs _active_limbo_lock. - del _active[get_ident()] - except: - pass + self._delete() def _stop(self): # After calling ._stop(), .is_alive() returns False and .join() returns