summaryrefslogtreecommitdiffstats
path: root/Lib/threading.py
diff options
context:
space:
mode:
authorTim Peters <tim@python.org>2013-10-26 01:46:51 (GMT)
committerTim Peters <tim@python.org>2013-10-26 01:46:51 (GMT)
commite5bb0bf04ded8ab623da08164c43059d3c68bd87 (patch)
tree5b24e6a8d5a627ad3035b717648b9da401dd61be /Lib/threading.py
parentbdb61387b753628c033030989a815b7dc02bde20 (diff)
downloadcpython-e5bb0bf04ded8ab623da08164c43059d3c68bd87.zip
cpython-e5bb0bf04ded8ab623da08164c43059d3c68bd87.tar.gz
cpython-e5bb0bf04ded8ab623da08164c43059d3c68bd87.tar.bz2
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.
Diffstat (limited to 'Lib/threading.py')
-rw-r--r--Lib/threading.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 185c980..0c92ab1 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1056,10 +1056,13 @@ class Thread:
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.