summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-04-26 01:02:07 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2009-04-26 01:02:07 (GMT)
commit71efeb7cbf9645815f6bc565dee1f0787359356a (patch)
tree6ad043ac6b5d77cb964ef17c1c88181f66bff195
parent7442bd9cdb5b169db90a1108132e79b14e9d41cd (diff)
downloadcpython-71efeb7cbf9645815f6bc565dee1f0787359356a.zip
cpython-71efeb7cbf9645815f6bc565dee1f0787359356a.tar.gz
cpython-71efeb7cbf9645815f6bc565dee1f0787359356a.tar.bz2
Merged revisions 71947 via svnmerge from
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. ........
-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 4f691b5..b85b977 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()
@@ -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(
diff --git a/Misc/NEWS b/Misc/NEWS
index b10fa94..8d98720 100644
--- 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
diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c
index 40694c6..8c710e0 100644
--- a/Objects/unicodectype.c
+++ b/Objects/unicodectype.c
@@ -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;