Skip to content

Commit 8cfe1ab

Browse files
miss-islingtonprithviraj-chaudhuriblurb-it[bot]
authored
[3.13] gh-142195: Fixed Popen.communicate indefinite loops (GH-143203) (#143256)
gh-142195: Fixed Popen.communicate indefinite loops (GH-143203) Changed condition to evaluate if timeout is less than or equals to 0. This is needed for simulated time environments such as Shadow where the time will match exactly on the boundary. --------- (cherry picked from commit fa9a425) Co-authored-by: Prithviraj Chaudhuri <p.chaudhuri1993@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent 750c3ef commit 8cfe1ab

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,7 @@ def _communicate(self, input, endtime, orig_timeout):
21432143

21442144
while selector.get_map():
21452145
timeout = self._remaining_time(endtime)
2146-
if timeout is not None and timeout < 0:
2146+
if timeout is not None and timeout <= 0:
21472147
self._check_timeout(endtime, orig_timeout,
21482148
stdout, stderr,
21492149
skip_check_and_raise=True)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updated timeout evaluation logic in :mod:`subprocess` to be compatible with deterministic environments like Shadow where time moves exactly as requested.

0 commit comments

Comments
 (0)