Skip to content

Commit 0a8a1b2

Browse files
committed
Remove check for timeout < 0 + rm test case which didn't make sense.
1 parent 527646d commit 0a8a1b2

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

Lib/subprocess.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,8 +2153,7 @@ def _wait(self, timeout):
21532153
return self.returncode
21542154

21552155
if timeout is not None:
2156-
if timeout < 0:
2157-
raise TimeoutExpired(self.args, timeout)
2156+
# Try fast wait first (pidfd on Linux, kqueue on BSD/macOS).
21582157
if self._wait_pidfd(timeout) or self._wait_kqueue(timeout):
21592158
self._blocking_wait()
21602159
else:

Lib/test/test_subprocess.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ def test_call_timeout(self):
163163
timeout=0.1)
164164

165165
def test_timeout_exception(self):
166-
try:
167-
subprocess.run([sys.executable, '-c', 'import time;time.sleep(9)'], timeout = -1)
168-
except subprocess.TimeoutExpired as e:
169-
self.assertIn("-1 seconds", str(e))
170-
else:
171-
self.fail("Expected TimeoutExpired exception not raised")
172166
try:
173167
subprocess.run([sys.executable, '-c', 'import time;time.sleep(9)'], timeout = 0)
174168
except subprocess.TimeoutExpired as e:

0 commit comments

Comments
 (0)