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 — `\p{...}` names ignore only spaces, though the docs promise whitespace · Issue #156185 · python/cpython

\p{...} names ignore only spaces, though the docs promise whitespace #156185

New issue
Copy link
New issue
Copy link
Open
Open
\p{...} names ignore only spaces, though the docs promise whitespace#156185
Copy link
Assignees
serhiy-storchaka
Labels
3.16new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@fedonman
fedonman
opened on Aug 21, 2026
Issue body actions

Bug description:

Doc/library/re.rst says of the \p{property=value} escape: "Property and value names are matched loosely: case, whitespace, '-' and '_' are ignored." _normalize() in Lib/re/_properties.py removes only U+0020, so a property or value name spelled with a tab, newline, carriage return, vertical tab or form feed is rejected.

import re

for name in ['L u', 'L\tu']:
    try:
        re.compile(r'\p{%s}' % name)
        print(repr(name), 'accepted')
    except re.PatternError as e:
        print(repr(name), 'rejected:', e.msg)
'L u' accepted
'L\tu' rejected: unknown property name 'L\tu'

Expected: both accepted, since the documentation says whitespace is ignored. UAX #44 UAX44-LM3, cited by _normalize()'s own comment, says to ignore whitespace rather than spaces.

Either side can change: narrow the documentation to "spaces", or strip \t\n\v\f\r in _normalize() to match UAX44-LM3. \p{...} is new in 3.16 and has not shipped, and the only user-visible effect either way is which spellings raise PatternError at compile time.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

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

Activity

  1. picnixz commented on Aug 21, 2026

    @picnixz
    picnixz
    on Aug 21, 2026
    Member
    More actions

    Honestly I think we don't care about non-traditional spaces but I guess it's just to match specs. Since it's 3.16 only it's ok to make the change.

    cc @serhiy-storchaka

  2. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    topic-regex
    3.16new features, bugs and security fixesnew features, bugs and security fixes
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 21, 2026
  3. serhiy-storchaka
    self-assigned this
    on Aug 21, 2026
  4. Georgefifth
    added a commit that references this issue on Aug 28, 2026

    pythongh-156185: Ignore all ASCII whitespace in re \p{} property names

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

Metadata

Metadata

Assignees

  • @serhiy-storchaka
    serhiy-storchaka

Labels

3.16new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.