bpo-44422: threading.Thread reuses the _delete() method (GH-26741)

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.
This commit is contained in:
Victor Stinner 2021-06-16 11:41:17 +02:00 committed by GitHub
parent 7cad9cb51b
commit 0729694246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View 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