Repository navigation
Conversation
Signed-off-by: Sungmin Park <ryan040@korea.ac.kr>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #1340
unicodedata.decomposition()used ICU'sNormalizer2.getDecomposition(), which applies the mapping recursively, so characters such asẤ,DŽor U+212B ANGSTROM SIGN got the fully expanded sequence. CPython returns the decomposition field from UnicodeData.txt as it is, which is whatgetRawDecomposition()gives. The one exception is Hangul syllables: CPython builds their full L V T jamo sequence (unicodedata.c#L430-L447), while the raw mapping of an LVT syllable is LV + T, so they keep usinggetDecomposition().AS-IS
TO-BE
(matching CPython)
Changes
UnicodeDataModuleBuiltins.DecompositionNode, usegetRawDecomposition(), andgetDecomposition()only for Hangul syllables (U+AC00 to U+D7A3).test_decompositiontotests/test_unicodedata.pywith multi-level mappings (DŽ,ẛ,Ǖ), a fraction, a character without a mapping, and an LV and an LVT syllable. It passes on CPython 3.13 and 3.14.Testing
mx python-jvmon darwin-aarch64, thenmx graalpytest test_unicodedata(9 passed) and--tagged test_unicodedata(41 passed). Over all code points, the output now equals CPython 3.13.18 for every character that CPython 3.13 assigns a mapping (514 differed before); the only remaining differences are characters added after Unicode 15.1. Without the change, the new test fails onDŽ.mx checkstyle --primaryandmx eclipseformat --primaryreport nothing.