diff Lib/threading.py @ 59200:eabfa778b076 legacy-trunk

Issue #7481: When a threading.Thread failed to start it would leave the instance stuck in initial state and present in threading.enumerate().
author Gregory P. Smith <greg@mad-scientist.com>
date Sun, 28 Feb 2010 18:36:09 +0000
parents cc367c077245
children 922079f724a6
line wrap: on
line diff
--- a/Lib/threading.py	Sun Feb 28 18:26:37 2010 +0000
+++ b/Lib/threading.py	Sun Feb 28 18:36:09 2010 +0000
@@ -469,7 +469,12 @@
             self._note("%s.start(): starting thread", self)
         with _active_limbo_lock:
             _limbo[self] = self
-        _start_new_thread(self.__bootstrap, ())
+        try:
+            _start_new_thread(self.__bootstrap, ())
+        except Exception:
+            with _active_limbo_lock:
+                del _limbo[self]
+            raise
         self.__started.wait()
 
     def run(self):