[Python-checkins] cpython: Fiddled Thread.join() to be a little simpler. Kinda ;-)

tim.peters python-checkins at python.org
Sat Oct 26 05:34:05 CEST 2013


http://hg.python.org/cpython/rev/506a07ea1173
changeset:   86644:506a07ea1173
user:        Tim Peters <tim at python.org>
date:        Fri Oct 25 22:33:52 2013 -0500
summary:
  Fiddled Thread.join() to be a little simpler.  Kinda ;-)

files:
  Lib/threading.py |  8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/Lib/threading.py b/Lib/threading.py
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1059,10 +1059,10 @@
 
         if timeout is None:
             self._wait_for_tstate_lock()
-        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
+        else:
+            # the behavior of a negative timeout isn't documented, but
+            # historically .join() has acted as if timeout=0 then
+            self._wait_for_tstate_lock(timeout=max(timeout, 0))
 
     def _wait_for_tstate_lock(self, block=True, timeout=-1):
         # Issue #18808: wait for the thread state to be gone.

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


More information about the Python-checkins mailing list