GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-95555: Fix a stale comment about negating \P in a character class by fedonman · Pull Request #156490 · python/cpython

Conversation

@fedonman

@fedonman fedonman commented Aug 27, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The comment above the [\P{Alphabetic}] assertion in test_property_escapes still says that, unlike an engine category, \P of a multi-range property cannot be negated inside a character class. GH-152245 lifted that restriction, and the same test now asserts fifty lines below that [\P{ASCII}], [\P{ASCII}abc] and [^\P{ASCII}] all match. The comment now states the distinction that does remain, which is how the member is compiled rather than whether it is allowed:

>>> re._parser.parse(r'[\P{Alphabetic}x]')
[(IN, [(CATEGORY, CATEGORY_NOT_ALPHA), (LITERAL, 120)])]
>>> re._parser.parse(r'[\P{ASCII}x]')
[(BRANCH, (None, [[(LITERAL, 120)], [(IN, [(NEGATE, None), (RANGE, (0, 127))])]]))]
test_property_escapes (test.test_re.ReTests.test_property_escapes) ... ok
Total tests: run=1 (filtered)
Result: SUCCESS

Comment-only change in a test file, so there is no news entry.

  • Issue: re should support \p{...} character properties #95555

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@fedonman
pythongh-95555: Fix a stale comment about negating \P in a character …
c56f3ac
…class

pythonGH-152245 lifted the restriction that a negated multi-range property
could not appear inside a character class, and added assertions in
test_property_escapes showing that [\P{ASCII}] and friends now match.
It left in place an earlier comment in the same test saying that,
unlike an engine category, \P of a multi-range property cannot be
negated inside a character class.

The distinction that remains is how the member is compiled, not
whether it is allowed: an engine category joins the set directly as a
CATEGORY, while a multi-range \P is alternated in as a separate branch.
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Aug 27, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Aug 27, 2026
re should support \p{...} character properties #95555
Open
@bedevere-app bedevere-app Bot added the awaiting review label Aug 27, 2026
@aisk aisk added the skip news label Aug 31, 2026
@ambv ambv mentioned this pull request Oct 20, 2026
gh-95555: Add the CATEGORY_UCD opcode and the simple enumerated properties #153023
Open
@fedonman

fedonman commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka, could you take a look when you have a moment? It fixes a test comment that GH-152245 made stale.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@fedonman @aisk
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.