]> granicus.if.org Git - python/commitdiff
Merged revisions 78646 via svnmerge from
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 4 Mar 2010 12:14:57 +0000 (12:14 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 4 Mar 2010 12:14:57 +0000 (12:14 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78646 | victor.stinner | 2010-03-04 13:09:33 +0100 (jeu., 04 mars 2010) | 5 lines

  Issue #1054943: Fix unicodedata.normalize('NFC', text) for the Public Review
  Issue #29.

  PR #29 was released in february 2004!
........

Lib/test/test_unicodedata.py
Misc/NEWS
Modules/unicodedata.c

index 2ecb09eafdc46bc5b9ffea98ba05cf1432676dfa..497886975d7a3a40765de729b107890286ed63df 100644 (file)
@@ -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')
index 3165733c4cc2004cb5e38a42da25169b351d2557..5a388b05ed6aacca4d9096871ddfe769584aa5dd 100644 (file)
--- 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.
 
index 90e94aae081df8a11e7a546861666c57f06c8f01..ecd744a4c23f599debc101d64fa8bd05a345102f 100644 (file)
@@ -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;