Skip to content

Fix glob pattern budgets across exclusions - #244

Merged
facelessuser merged 1 commit into
facelessuser:mainfrom
JackyHsu-X:fix/glob-exclude-pattern-limit
Oct 18, 2026
Merged

facelessuser merged 1 commit into
facelessuser:mainfrom
JackyHsu-X:fix/glob-exclude-pattern-limit

Conversation

@JackyHsu-X

Copy link
Copy Markdown
Contributor

glob.glob('a', exclude='b', limit=1) currently succeeds even though the include and exclusion expand to two patterns. The scanning Glob class starts a new count for each group, so plain patterns and SPLIT expansions can exceed the shared limit. This is separate from the compilation and translation paths fixed in #243.

Keep the expanded-pattern count on the Glob instance across both groups. Only reduce the brace expansion allowance for positive limits, preserving unlimited expansion for zero and negative limits after an earlier pattern.

Add regressions for glob and iglob, string and bytes inputs, include/exclude lists, repeated patterns, BRACE and SPLIT expansion, exact limits, and the implicit NODIR filter. Include a changelog entry.

Validation on Windows / Python 3.12.8:

  • New regressions against unchanged production code: 40 failed, 20 passed.
  • With the fix: all 60 new cases pass.
  • Full suite: 1,342 passed, 167 skipped, 12 subtests passed; 97% combined line/branch coverage. Changed executable lines and decision branches are covered.
  • python -m ruff check ., python -m mypy, and git diff --check pass.

The hosted operating-system/Python matrix and documentation build have not been run locally. AI tools assisted with implementation and review; the reproduction and checks were run locally.

@gir-bot gir-bot added S: needs-review Needs to be reviewed and/or approved. C: docs Related to documentation. C: glob Glob library. C: source Related to source code. C: tests Related to testing. labels Oct 18, 2026
@facelessuser

Copy link
Copy Markdown
Owner

@gir-bot lgtm

@gir-bot gir-bot added S: approved The pull request is ready to be merged. and removed S: needs-review Needs to be reviewed and/or approved. labels Oct 18, 2026
@facelessuser
facelessuser merged commit 87d8907 into facelessuser:main Oct 18, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: docs Related to documentation. C: glob Glob library. C: source Related to source code. C: tests Related to testing. S: approved The pull request is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants