]> granicus.if.org Git - python/commitdiff
Merged revisions 71947 via svnmerge from
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 26 Apr 2009 01:02:07 +0000 (01:02 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 26 Apr 2009 01:02:07 +0000 (01:02 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71947 | martin.v.loewis | 2009-04-26 02:53:18 +0200 (So, 26 Apr 2009) | 3 lines

  Issue #4971: Fix titlecase for characters that are their own
  titlecase, but not their own uppercase.
........

Lib/test/test_unicodedata.py
Misc/NEWS
Objects/unicodectype.c

index 4f691b5bdf7b2ff673b28a4fbb97eac37f709b2d..b85b9779dfd5f68bee6f42fe238d62b660e0dc42 100644 (file)
@@ -20,7 +20,7 @@ encoding = 'utf-8'
 class UnicodeMethodsTest(unittest.TestCase):
 
     # update this, if the database changes
-    expectedchecksum = 'b7db9b5f1d804976fa921d2009cbef6f025620c1'
+    expectedchecksum = '6ec65b65835614ec00634c674bba0e50cd32c189'
 
     def test_method_checksum(self):
         h = hashlib.sha1()
@@ -271,6 +271,11 @@ class UnicodeMiscTest(UnicodeDatabaseTest):
             [0]
         )
 
+    def test_buf_4971(self):
+        # LETTER DZ WITH CARON: DZ, Dz, dz
+        self.assertEqual("\u01c4".title(), "\u01c5")
+        self.assertEqual("\u01c5".title(), "\u01c5")
+        self.assertEqual("\u01c6".title(), "\u01c5")
 
 def test_main():
     test.support.run_unittest(
index b10fa947aa06d8ca74ba834c6c7620c743c42121..8d98720172a9e30afd9976283a0d265468c3c7ed 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 3.1 beta 1?
 Core and Builtins
 -----------------
 
+- Issue #4971: Fix titlecase for characters that are their own
+  titlecase, but not their own uppercase.
+
 - Issue #5283: Setting __class__ in __del__ caused a segfault.
 
 - Issue #5816: complex(repr(z)) now recovers z exactly, even when
index 40694c619cfda54d495e617285e6deba065939a0..8c710e05b70159c94ba7ad2e1b3d8edd1033a176 100644 (file)
@@ -79,12 +79,7 @@ int _PyUnicode_IsLinebreak(register const Py_UNICODE ch)
 Py_UNICODE _PyUnicode_ToTitlecase(register Py_UNICODE ch)
 {
     const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
-    int delta;
-
-    if (ctype->title)
-        delta = ctype->title;
-    else
-       delta = ctype->upper;
+    int delta = ctype->title;
 
     if (ctype->flags & NODELTA_MASK)
        return delta;