]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-95555: Allow a negated property as a character set member (GH-152245)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 26 Jun 2026 11:15:12 +0000 (14:15 +0300)
committerGitHub <noreply@github.com>
Fri, 26 Jun 2026 11:15:12 +0000 (14:15 +0300)
commit8eb6fb0294956f3aaca0ace76b5ee77bd84b03a0
tree0c89f471bd505dc722a3eec2dd96b7ea89be90e2
parentd91e1038e81e8e4416fcca4baefc617249b0d38c
gh-95555: Allow a negated property as a character set member (GH-152245)

A negated multi-range property such as \P{ASCII} or \P{Pattern_Syntax} was
rejected inside a character class.  Such members are now alternated in with
the other members: [\P{ASCII}abc] becomes [abc] | [^ASCII], and [\P{ASCII}]
alone is just the negated charset.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Lib/re/_parser.py
Lib/test/test_re.py