[3.15] gh-154836: Fix Popen.wait() with very large timeouts on the pidfd/kqueue wait paths (GH-154837) - #154891
Merged
Merged
Conversation
…fd/kqueue wait paths (pythonGH-154837) The event-driven wait introduced by pythongh-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. (cherry picked from commit 11d0da5b54b1a162e8f2566675007cfb2db797b5) Co-authored-by: Calvin Prewitt <calvin@setout.dev> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
gpshead
enabled auto-merge (squash)
July 29, 2026 17:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
following asyncio's MAXIMUM_SELECT_TIMEOUT precedent) and loop until
the real deadline in both _wait_pidfd() and _wait_kqueue().
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.
(cherry picked from commit 11d0da5)
Co-authored-by: Calvin Prewitt calvin@setout.dev
Co-authored-by: Claude Fable 5 noreply@anthropic.com
Popen.wait(timeout=float("inf"))raisesTypeError: timeout must be a real number or Noneon macOS/BSD (new kqueue wait path) #154836Fixes #154836