Skip to content

Commit bfc8c24

Browse files
committed
gh-133089: Make subprocess.run's behavior is same with 'timeout=None' when the timeout is zero
Signed-off-by: Manjusaka <[email protected]>
1 parent 3940e1f commit bfc8c24

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/subprocess.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,8 @@ def communicate(self, input=None, timeout=None):
11911191
universal_newlines.
11921192
"""
11931193

1194+
timeout = None if timeout == 0 else timeout
1195+
11941196
if self._communication_started and input:
11951197
raise ValueError("Cannot send input after starting communication")
11961198

@@ -1268,6 +1270,7 @@ def _check_timeout(self, endtime, orig_timeout, stdout_seq, stderr_seq,
12681270

12691271

12701272
def wait(self, timeout=None):
1273+
timeout = None if timeout == 0 else timeout
12711274
"""Wait for child process to terminate; returns self.returncode."""
12721275
if timeout is not None:
12731276
endtime = _time() + timeout

0 commit comments

Comments
 (0)