Skip to content

gh-156518: Return the simple case mappings defined by the UCD - #156519

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:unicode-simple-case-mappings
Open

gh-156518: Return the simple case mappings defined by the UCD#156519
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:unicode-simple-case-mappings

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

The three macros now return the character itself when its full case mapping is longer than one character, and the simple mapping which Tools/unicode/makeunicodedata.py does not store for the 27 Greek letters with ypogegrammeni and for LATIN CAPITAL LETTER I WITH DOT ABOVE.

They agree now with fields 12, 13 and 14 of UnicodeData.txt for every code point.

_sre.unicode_iscased() compared the simple mappings with the character, which no longer detects a cased character having none, so it compares the full mappings instead. It is unchanged for every code point.

Py_UNICODE_TOUPPER(), Py_UNICODE_TOLOWER() and Py_UNICODE_TOTITLE() returned
the first character of the full mapping when it is longer than one character,
which the UCD does not define as a simple mapping: the simple uppercase of
LATIN SMALL LETTER SHARP S is itself, not "S".  Return the character itself in
that case, or the simple mapping which Tools/unicode/makeunicodedata.py does
not store: the Greek letters with ypogegrammeni are uppercased to the letter
with prosgegrammeni, and LATIN CAPITAL LETTER I WITH DOT ABOVE is lowercased
to LATIN SMALL LETTER I.

_sre.unicode_iscased() no longer infers casedness from the simple mappings,
which a cased character can lack, but compares the full mappings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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