FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-101372: Fix unicodedata.is_normalized to properly handle the UCD 3… by corona10 · Pull Request #101388 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .py  (1) .rst  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions Lib/test/test_unicodedata.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ def test_issue29456(self):
self.assertEqual(self.db.normalize('NFC', u11a7_str_a), u11a7_str_b)
self.assertEqual(self.db.normalize('NFC', u11c3_str_a), u11c3_str_b)

def test_is_normalized_unicode_3_2_0(self):
Comment thread
corona10 marked this conversation as resolved.
Resolved
for x in range(0x110000):
for form in ('NFC', 'NFD', 'NFKC', 'NFKD'):
normalized = self.db.ucd_3_2_0.normalize(form, chr(x))
self.assertTrue(self.db.ucd_3_2_0.is_normalized(form, normalized))

def test_east_asian_width(self):
eaw = self.db.east_asian_width
self.assertRaises(TypeError, eaw, b'a')
Expand Down
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix :func:`~unicodedata.is_normalized` to properly handle the UCD 3.2.0
cases. Patch by Dong-hee Na.
2 changes: 1 addition & 1 deletion Modules/unicodedata.c
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
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ is_normalized_quickcheck(PyObject *self, PyObject *input, bool nfc, bool k,
{
/* UCD 3.2.0 is requested, quickchecks must be disabled. */
if (UCD_Check(self)) {
return NO;
return MAYBE;
}

if (PyUnicode_IS_ASCII(input)) {
Expand Down

Back | FazBrowse Home | New Git URL