Repository navigation
fix(query): validate PY_DISCOVERY_TIMEOUT - #143
Merged
Merged
Conversation
…ough The override went float(env["PY_DISCOVERY_TIMEOUT"]) straight into communicate(), so a typo in the variable took discovery down with it. An empty or non-numeric value raised ValueError out of from_exe with no mention of the variable. "nan" raised the thread lock's own ValueError, "inf" and anything past the platform wait limit OverflowError. "0" or a negative number made every interpreter time out at once, so discovery quietly found nothing. Parse it once. Anything that isn't a positive number of seconds is ignored with one warning that names the variable, and the default 15 applies. inf, or a value beyond what poll(2) can take in milliseconds, means no timeout, which is what communicate(None) does. The parse is cached per value so the warning shows once per process, not once per interpreter probed.
Long-running callers can supply distinct timeout values without limit. Bound the parse cache and verify warning eviction through interpreter queries. Simplify validation and document the subprocess wait ceiling.
gaborbernat
enabled auto-merge (squash)
October 10, 2026 00:52
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.

Invalid
PY_DISCOVERY_TIMEOUTvalues can raiseValueErrororOverflowError, or cause interpreter queries to time out before they can answer.Use the default of 15 seconds and log a warning for invalid values, including
nan, zero and negative numbers. Acceptinfor values above 2,147,483.647 seconds to disable the timeout; this ceiling accommodates subprocess waits that use signed 32-bit milliseconds.Cache the most recent 128 values to avoid repeated warnings during discovery without retaining an unbounded set of environment values.