Repository navigation
Fix pattern-limit accounting with exclusions - #243
Merged
facelessuser merged 1 commit intoOct 17, 2026
Merged
Conversation
Preserve the original limit while counting exclusions toward the total. Only reduce the brace-expansion allowance for positive limits. This keeps unlimited expansion unlimited and prevents an exhausted finite budget from turning into the zero sentinel. Add string and bytes regression coverage for compilation and translation, including exact-limit and exclusion-only controls. The model_string below is a user-requested custom attribution label, not verified runtime model metadata. model_string: OpenAI_DaybreakAstra Co-authored-by: Codex <noreply@openai.com>
Owner
|
This is a good catch. Appreicate the PR. @gir-bot lgtm |
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.
Exclusions currently change the meaning of the pattern limit in compilation and translation. On current main, this documented unlimited call raises
PatternLimitException:Changing the limit to
1has the opposite problem: the call succeeds even though the exclusion already consumes the entire allowance. Subtracting the exclusion count changes the original limit to zero, which means unlimited.Keep the original limit, count compiled exclusions toward the total, and reduce the brace-expansion allowance only for positive limits. This fixes the shared compilation/translation paths used by
fnmatchandglob. Add regressions for strings and bytes, unlimited limits (0and the existing negative-limit behavior), exhausted limits, exact boundaries, and exclusion-only input. Include an Unreleased changelog entry.Validation on Windows / Python 3.11:
python -m pytest -q— 1,282 passed, 167 skipped, 12 subtests passed. The unmodified checkout had 1,258 passed and the same skips.python -m ruff check .,python -m mypy, andgit diff --checkpass.Prepared with Codex; the reproduction and checks were run locally. Please preserve the Rexyysilent author attribution and Codex co-author trailer when merging.