python / python/cpython

`\p{Alphabetic}` matches `gc=L`, not the Unicode Alphabetic property

Offen
#155,498 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@serhiy-storchaka arbeitet bereits daran.

Seit 16.8.2026.

stdlib topic-regex type-bug
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Bug description:

The Unicode Alphabetic property is derived as Uppercase + Lowercase + Lt + Lm + Lo + Nl + Other_Alphabetic, so \p{Uppercase} and \p{Lowercase} are subsets of \p{Alphabetic}. In re they are not:

$ ./python -c "import re; print(bool(re.fullmatch(r'\p{Uppercase}', 'Ⅰ')), bool(re.fullmatch(r'\p{Alphabetic}', 'Ⅰ')))"
True False

U+2160 ROMAN NUMERAL ONE is gc=Nl with Other_Uppercase=Yes. 163 characters match \p{Uppercase} or \p{Lowercase} but not \p{Alphabetic}, which matches General_Category=L exactly, the same set as \p{L}. The POSIX alias \p{alpha} behaves the same way. Doc/library/re.rst lists Alphabetic among the supported binary properties and names only space and xdigit as deviations from UTS #18 RL1.2.

Expected: \p{Alphabetic} matches the UCD property, or the deviation is documented alongside space and xdigit.

Not gh-56940 (\w under RL1.2a, predates \p{...}), and not covered by GH-153023, whose properties are the enumerated ones plus ccc, Bidi_Mirrored and Extended_Pictographic.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.