diff options
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index d010b80..8661cde 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -391,6 +391,9 @@ class Thread(_Verbose): # shutdown and thus raises an exception about trying to perform some # operation on/with a NoneType __exc_info = _sys.exc_info + # Keep sys.exc_clear too to clear the exception just before + # allowing .join() to return. + #XXX __exc_clear = _sys.exc_clear def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None): @@ -527,6 +530,13 @@ class Thread(_Verbose): else: if __debug__: self._note("%s._bootstrap(): normal return", self) + finally: + # Prevent a race in + # test_threading.test_no_refcycle_through_target when + # the exception keeps the target alive past when we + # assert that it's dead. + #XXX self.__exc_clear() + pass finally: with _active_limbo_lock: self._stop() |