Commit e5bb0bf0 authored by Tim Peters's avatar Tim Peters

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.
parent bdb61387
...@@ -1056,10 +1056,13 @@ class Thread: ...@@ -1056,10 +1056,13 @@ class Thread:
raise RuntimeError("cannot join thread before it is started") raise RuntimeError("cannot join thread before it is started")
if self is current_thread(): if self is current_thread():
raise RuntimeError("cannot join current thread") raise RuntimeError("cannot join current thread")
if timeout is None: if timeout is None:
self._wait_for_tstate_lock() self._wait_for_tstate_lock()
else: elif timeout >= 0:
self._wait_for_tstate_lock(timeout=timeout) 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): def _wait_for_tstate_lock(self, block=True, timeout=-1):
# Issue #18808: wait for the thread state to be gone. # Issue #18808: wait for the thread state to be gone.
......
...@@ -27,6 +27,8 @@ Core and Builtins ...@@ -27,6 +27,8 @@ Core and Builtins
Library Library
------- -------
- Issue #19399: fix sporadic test_subprocess failure.
- Issue #13234: Fix os.listdir to work with extended paths on Windows. - Issue #13234: Fix os.listdir to work with extended paths on Windows.
Patch by Santoso Wijaya. Patch by Santoso Wijaya.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment