]> 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:01:58 +0000 (01:01 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 26 Apr 2009 01:01:58 +0000 (01:01 +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 18f37f85b96ec66a7a57d841b018e69c4027249c..1651b4644bad266d168c0596e9fe0d282a559144 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()
@@ -270,6 +270,11 @@ class UnicodeMiscTest(UnicodeDatabaseTest):
             [0]
         )
 
+    def test_buf_4971(self):
+        # LETTER DZ WITH CARON: DZ, Dz, dz
+        self.assertEqual(u"\u01c4".title(), u"\u01c5")
+        self.assertEqual(u"\u01c5".title(), u"\u01c5")
+        self.assertEqual(u"\u01c6".title(), u"\u01c5")
 
 def test_main():
     test.test_support.run_unittest(
index c303e49eb013b679b0cb1359b826d189208db81d..65ba2c15978779f11b39ddc0e191c5dc754dcf8a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6.3
 Core and Builtins
 -----------------
 
+- Issue #4971: Fix titlecase for characters that are their own
+  titlecase, but not their own uppercase.
+
 - Issue #5829: complex('1e-500') no longer raises an exception
 
 - Issue #5787: object.__getattribute__(some_type, "__bases__") segfaulted on
index ebfb5b701243d851956cd4ab1211d040239d3a0c..2afafb8da25c13bf067e70846d26aa51291c39a8 100644 (file)
@@ -76,12 +76,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;