]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44422: threading.Thread reuses the _delete() method (GH-26741)
authorVictor Stinner <vstinner@python.org>
Wed, 16 Jun 2021 09:41:17 +0000 (11:41 +0200)
committerGitHub <noreply@github.com>
Wed, 16 Jun 2021 09:41:17 +0000 (11:41 +0200)
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

index 766011fa0312b34e01c534c89de9defd62ed56c6..c2b94a5045514fef8ca55cb0f728a28a6cb903a6 100644 (file)
@@ -1010,13 +1010,7 @@ class Thread:
             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