summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-04-26 00:53:18 +0000
committerMartin v. Löwis <martin@v.loewis.de>2009-04-26 00:53:18 +0000
commit99f277933e172cd035f049f2de4a9033f43a55dc (patch)
tree9cce0c07dc3c71e2d0e6dfb888690c0fc51f2c14
parent068f06568be288b8628a4e24118503e4d9b7af1b (diff)
downloadcpython-git-99f277933e172cd035f049f2de4a9033f43a55dc.tar.gz
Issue #4971: Fix titlecase for characters that are their own
titlecase, but not their own uppercase.
-rw-r--r--Lib/test/test_unicodedata.py7
-rw-r--r--Misc/NEWS3
-rw-r--r--Objects/unicodectype.c7
3 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index 18f37f85b9..1651b4644b 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -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(
diff --git a/Misc/NEWS b/Misc/NEWS
index b21151236b..7c705f1c7f 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
Core and Builtins
-----------------
+- Issue #4971: Fix titlecase for characters that are their own
+ titlecase, but not their own uppercase.
+
- Issue #5835: Deprecate PyOS_ascii_formatd and replace it with
_PyOS_double_to_string or PyOS_double_to_string.
diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c
index ebfb5b7012..2afafb8da2 100644
--- a/Objects/unicodectype.c
+++ b/Objects/unicodectype.c
@@ -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;