diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 17333d8c02255d..3cebd7883fcf29 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -2140,7 +2140,7 @@ def _communicate(self, input, endtime, orig_timeout): while selector.get_map(): timeout = self._remaining_time(endtime) - if timeout is not None and timeout < 0: + if timeout is not None and timeout <= 0: self._check_timeout(endtime, orig_timeout, stdout, stderr, skip_check_and_raise=True) diff --git a/Misc/NEWS.d/next/Library/2025-12-27-00-14-56.gh-issue-142195.UgBEo5.rst b/Misc/NEWS.d/next/Library/2025-12-27-00-14-56.gh-issue-142195.UgBEo5.rst new file mode 100644 index 00000000000000..6cf7b9df1bc04a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-27-00-14-56.gh-issue-142195.UgBEo5.rst @@ -0,0 +1 @@ +Updated timeout evaluation logic to be compatible with deterministic environments like Shadow where time moves exactly as requested.