summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_unicodedata.py5
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/unicodedata.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index 2ecb09e..4978869 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -187,6 +187,11 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
# The rest can be found in test_normalization.py
# which requires an external file.
+ def test_pr29(self):
+ # http://www.unicode.org/review/pr-29.html
+ for text in (u"\u0b47\u0300\u0b3e", u"\u1100\u0300\u1161"):
+ self.assertEqual(self.db.normalize('NFC', text), text)
+
def test_east_asian_width(self):
eaw = self.db.east_asian_width
self.assertRaises(TypeError, eaw, b'a')
diff --git a/Misc/NEWS b/Misc/NEWS
index 3165733..5a388b0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -268,6 +268,9 @@ C-API
Library
-------
+- Issue #1054943: Fix unicodedata.normalize('NFC', text) for the Public Review
+ Issue #29
+
- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
reset also the pointer to the current pointer context.
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 90e94aa..ecd744a 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -684,7 +684,7 @@ nfc_nfkc(PyObject *self, PyObject *input, int k)
comb = 0;
while (i1 < end) {
int comb1 = _getrecord_ex(*i1)->combining;
- if (comb1 && comb == comb1) {
+ if (comb && (comb1 == 0 || comb == comb1)) {
/* Character is blocked. */
i1++;
continue;