FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-156185: Ignore all ASCII whitespace in re \p{} property names by Georgefifth · Pull Request #156304 · python/cpython · GitHub

/ cpython Public

gh-156185: Ignore all ASCII whitespace in re \p{} property names - #156304

Open
Georgefifth wants to merge 1 commit into
python:mainfrom
Georgefifth:fix/re-property-whitespace
Open

gh-156185: Ignore all ASCII whitespace in re \p{} property names#156304
Georgefifth wants to merge 1 commit into
python:mainfrom
Georgefifth:fix/re-property-whitespace

Conversation

Georgefifth commented Aug 24, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown

Problem
The docs (and the _normalize comment) promise that \p{...} property and value names are matched loosely — case, whitespace, hyphens and underscores are not significant (UAX #44, LM3). In practice only spaces were removed, so \p{L\tu} or \p{G\nC=Lu} raised re.error: unknown property "L\ntu" while the space form worked. (3.16-only feature, so no compatibility concern.)

Solution
_normalize() in Lib/re/_properties.py now drops all ASCII whitespace ( \t\n\r\f\v), not just space; comment updated to match.

Result
Added a regression loop over all six whitespace characters in test_re.py::test_property_escapes; full test_re passes (169 tests) on a debug build, and the new assertions fail on the unpatched code. NEWS entry added.

The docs promise property and value names are matched loosely
(whitespace not significant), but _normalize() only removed spaces.
Now tab/newline/cr/formfeed/vertical-tab are ignored as well.

python-cla-bot Bot commented Aug 24, 2026
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL