Skip to content

Fix exclusion patterns in Cython Box constructors - #334

Closed
MbappeWU wants to merge 1 commit into
cdgriffith:developfrom
MbappeWU:fix/cython-exclusion-patterns
Closed

MbappeWU wants to merge 1 commit into
cdgriffith:developfrom
MbappeWU:fix/cython-exclusion-patterns

Conversation

@MbappeWU

@MbappeWU MbappeWU commented Oct 3, 2026

Copy link
Copy Markdown

A Cython-built Box raises TypeError: expected str, got re.Pattern when a string box_dots_exclude is propagated to nested boxes or reconstructed during copying. Box compiles the string internally, but its two constructor annotations and stubs only allow str | None.

Correct those signatures to str | re.Pattern[str] | None, matching the values already accepted by pure Python and passed through internal configuration. Keep the existing normalization and regex flags. Add regressions for both string and compiled-pattern inputs, nested mappings/lists, and copying.

Validation:

  • Full pure-Python and fresh Cython suites: 161 passed each. Exact old compiled runtime: 2 regression failures / 1 passing control; final: 3 passed.
  • Black 24.10.0, mypy, and all required pre-commit hooks passed. An installed-stub consumer accepts string/Pattern[str]/None and rejects integer/bytes inputs.
  • Original 34-job Tests workflow passed, including all four manylinux targets. The CI snapshot has the exact same Git tree as this feature commit; no workflow files were changed.
  • Built wheel/sdist integrity and all 16 tracked runtime files checked against the commit. Nineteen configuration scenarios match across source, the exact old pure-Python runtime, and the installed compiled wheel, including matching flags and copy results.

Those probes also record the existing option reset in BoxList.__deepcopy__; copied-child states match the pure-Python baseline rather than being reported as complete option preservation.

AI-assisted implementation and validation with Codex.

@MbappeWU

Copy link
Copy Markdown
Author

Tidying up my open PRs, so I'm closing this one while the repo seems inactive. Feel free to ping me and I'll reopen or rebase.

@MbappeWU MbappeWU closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant