Merged revisions 78646 via svnmerge from
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 21 Mar 2010 13:41:15 +0000 (13:41 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 21 Mar 2010 13:41:15 +0000 (13:41 +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 baa36cbf1877856bd69731d6f9916952a606f551..61a10318bb18a0ea15e3b88427f82f6192bbd260 100644 (file)
@@ -185,6 +185,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, 'a')
index 96dbd20cb6d1198e3ce7671674416296dc000057..6d438ca176b033a75f501b6ec763306b64cf9185 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,9 @@ Core and Builtins
 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 ad77651a26c4fce17f918b61d4eaac990071017a..0e61877e022b82da2074e9211e4c8e2e40735fb2 100644 (file)
@@ -681,7 +681,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;