[Python-checkins] cpython: Issue #19399: fix sporadic test_subprocess failure.

tim.peters python-checkins at python.org
Sat Oct 26 03:47:06 CEST 2013


http://hg.python.org/cpython/rev/af67cfcd4089
changeset:   86643:af67cfcd4089
user:        Tim Peters <tim at python.org>
date:        Fri Oct 25 20:46:51 2013 -0500
summary:
  Issue #19399: fix sporadic test_subprocess failure.

Change Thread.join() with a negative timeout to just return.  The
behavior isn't documented then, but this restores previous
behavior.

files:
  Lib/threading.py |  5 ++++-
  Misc/NEWS        |  2 ++
  2 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Lib/threading.py b/Lib/threading.py
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1056,10 +1056,13 @@
             raise RuntimeError("cannot join thread before it is started")
         if self is current_thread():
             raise RuntimeError("cannot join current thread")
+
         if timeout is None:
             self._wait_for_tstate_lock()
-        else:
+        elif timeout >= 0:
             self._wait_for_tstate_lock(timeout=timeout)
+        # else it's a negative timeout - precise behavior isn't documented
+        # then, but historically .join() returned in this case
 
     def _wait_for_tstate_lock(self, block=True, timeout=-1):
         # Issue #18808: wait for the thread state to be gone.
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,8 @@
 Library
 -------
 
+- Issue #19399: fix sporadic test_subprocess failure.
+
 - Issue #13234: Fix os.listdir to work with extended paths on Windows.
   Patch by Santoso Wijaya.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list