Skip to content

gh-161814: Fix Unicode property matching in case-insensitive sets - #162253

Open
sunsss123soldier wants to merge 2 commits into
python:mainfrom
sunsss123soldier:gh-161814-re-unicode-ignorecase
Open

sunsss123soldier wants to merge 2 commits into
python:mainfrom
sunsss123soldier:gh-161814-re-unicode-ignorecase

Conversation

@sunsss123soldier

@sunsss123soldier sunsss123soldier commented Nov 19, 2026 •

Copy link
Copy Markdown

Fixes #161814

In a case-insensitive character set, lowercasing the input before every check can change whether it matches a Unicode property such as \p{Lu}. Following the approach suggested in the issue, the matcher now uses the original input for category checks and the lowercased input for literals and ranges.

The regression tests cover ASCII and Unicode ignore-case modes, literals and ranges, negated character sets, and negated property escapes.

Validation

  • Windows x64 Release build
  • python -m test test_re (173 run, 4 skipped)
  • CPython patchcheck, Ruff 0.17.4, and sphinx-lint on the NEWS entry

Codex assisted with the tests.

@python-cla-bot

python-cla-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regex: Improper handling of Unicode Properties in character set 3.16a2

1 participant