Skip to content

Commit e5bb0bf

Browse files
author
Tim Peters
committed
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.
1 parent bdb6138 commit e5bb0bf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/threading.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,10 +1056,13 @@ def join(self, timeout=None):
10561056
raise RuntimeError("cannot join thread before it is started")
10571057
if self is current_thread():
10581058
raise RuntimeError("cannot join current thread")
1059+
10591060
if timeout is None:
10601061
self._wait_for_tstate_lock()
1061-
else:
1062+
elif timeout >= 0:
10621063
self._wait_for_tstate_lock(timeout=timeout)
1064+
# else it's a negative timeout - precise behavior isn't documented
1065+
# then, but historically .join() returned in this case
10631066

10641067
def _wait_for_tstate_lock(self, block=True, timeout=-1):
10651068
# Issue #18808: wait for the thread state to be gone.

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Core and Builtins
2727
Library
2828
-------
2929

30+
- Issue #19399: fix sporadic test_subprocess failure.
31+
3032
- Issue #13234: Fix os.listdir to work with extended paths on Windows.
3133
Patch by Santoso Wijaya.
3234

0 commit comments

Comments
 (0)