Skip to content
Merged
3 changes: 3 additions & 0 deletions Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,8 @@ def communicate(self, input=None, timeout=None):
universal_newlines.
"""

timeout = None if timeout == 0 else timeout

if self._communication_started and input:
raise ValueError("Cannot send input after starting communication")

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


def wait(self, timeout=None):
timeout = None if timeout == 0 else timeout
"""Wait for child process to terminate; returns self.returncode."""
if timeout is not None:
endtime = _time() + timeout
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Make :func:`subprocess.run`'s behavior is same with 'timeout=None' when
the timeout is zero
Loading