diff options
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 98d15b240a..50cbb06fff 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -515,11 +515,14 @@ class Thread(_Verbose): if __debug__: self._note("%s.__bootstrap(): normal return", self) finally: - self.__stop() - try: - self.__delete() - except: - pass + with _active_limbo_lock: + self.__stop() + try: + # We don't call self.__delete() because it also + # grabs _active_limbo_lock. + del _active[_get_ident()] + except: + pass def __stop(self): with self.__block: |