]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-154836: Fix Popen.wait() with very large timeouts on the pidfd/kqueue wait paths...
authorCalvin Prewitt <calvin@setout.dev>
Wed, 29 Jul 2026 17:45:41 +0000 (12:45 -0500)
committerGitHub <noreply@github.com>
Wed, 29 Jul 2026 17:45:41 +0000 (10:45 -0700)
commit11d0da5b54b1a162e8f2566675007cfb2db797b5
tree0a40cef15641578abb1296ddaf7438e9e0f6412f
parent3fd36fadbe8ad31213b90757d196870213bf07ba
gh-154836: Fix Popen.wait() with very large timeouts on the pidfd/kqueue wait paths (GH-154837)

The event-driven wait introduced by gh-83069 passes the caller's timeout
unclamped to poll() / kqueue.control(), so values that do not fit the C
timestamp conversion (float('inf'), sys.maxsize, 1e10, ...) raise
OverflowError on Linux and, on macOS/BSD, a misleading
"TypeError: timeout must be a real number or None" -- all of which
worked on 3.14 and earlier.

- Lib/subprocess.py: clamp each wait to _MAXIMUM_WAIT_TIMEOUT (24h,
  following asyncio's MAXIMUM_SELECT_TIMEOUT precedent) and loop until
  the real deadline in both _wait_pidfd() and _wait_kqueue().
- Modules/selectmodule.c: only rewrite the kqueue.control() timeout
  conversion failure into TypeError when the original exception IS a
  TypeError, exactly like the select()/poll()/devpoll()/epoll() sites,
  so OverflowError surfaces for out-of-range values.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Lib/subprocess.py
Lib/test/test_kqueue.py
Lib/test/test_subprocess.py
Misc/NEWS.d/next/Library/2026-07-19-20-00-00.gh-issue-154836.kqWait.rst [new file with mode: 0644]
Modules/selectmodule.c