[Python-checkins] r78646 - in python/trunk: Lib/test/test_unicodedata.py Misc/NEWS Modules/unicodedata.c

victor.stinner python-checkins at python.org
Thu Mar 4 13:09:34 CET 2010


Author: victor.stinner
Date: Thu Mar  4 13:09:33 2010
New Revision: 78646

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

PR #29 was released in february 2004!


Modified:
   python/trunk/Lib/test/test_unicodedata.py
   python/trunk/Misc/NEWS
   python/trunk/Modules/unicodedata.c

Modified: python/trunk/Lib/test/test_unicodedata.py
==============================================================================
--- python/trunk/Lib/test/test_unicodedata.py	(original)
+++ python/trunk/Lib/test/test_unicodedata.py	Thu Mar  4 13:09:33 2010
@@ -186,6 +186,11 @@
         # 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')

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Thu Mar  4 13:09:33 2010
@@ -41,6 +41,9 @@
 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.
 

Modified: python/trunk/Modules/unicodedata.c
==============================================================================
--- python/trunk/Modules/unicodedata.c	(original)
+++ python/trunk/Modules/unicodedata.c	Thu Mar  4 13:09:33 2010
@@ -682,7 +682,7 @@
       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;


More information about the Python-checkins mailing list