summaryrefslogtreecommitdiff
path: root/Lib/threading.py
diff options
context:
space:
mode:
authorTim Peters <tim@python.org>2013-10-25 20:46:51 -0500
committerTim Peters <tim@python.org>2013-10-25 20:46:51 -0500
commite5bb0bf04ded8ab623da08164c43059d3c68bd87 (patch)
tree5b24e6a8d5a627ad3035b717648b9da401dd61be /Lib/threading.py
parentbdb61387b753628c033030989a815b7dc02bde20 (diff)
downloadcpython-git-e5bb0bf04ded8ab623da08164c43059d3c68bd87.tar.gz
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 185c980ce0..0c92ab10d0 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.