Author: Manuel Jacob
Branch: refactor-str-types
Changeset: r65819:3c21a8894676
Date: 2013-07-30 00:14 +0200
http://bitbucket.org/pypy/pypy/changeset/3c21a8894676/
Log: Fix descr_title().
diff --git a/pypy/objspace/std/bytearrayobject.py
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -91,6 +91,8 @@
else:
return ch
+ _title = _upper
+
def _join_return_one(self, space, w_obj):
return False
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -134,6 +134,8 @@
else:
return ch
+ _title = _upper
+
def _newlist_unwrapped(self, space, lst):
return space.newlist_str(lst)
diff --git a/pypy/objspace/std/stringmethods.py
b/pypy/objspace/std/stringmethods.py
--- a/pypy/objspace/std/stringmethods.py
+++ b/pypy/objspace/std/stringmethods.py
@@ -761,7 +761,7 @@
for pos in range(len(selfval)):
ch = selfval[pos]
if not previous_is_cased:
- builder.append(self._upper(ch))
+ builder.append(self._title(ch))
else:
builder.append(self._lower(ch))
previous_is_cased = self._iscased(ch)
diff --git a/pypy/objspace/std/unicodeobject.py
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -134,6 +134,9 @@
def _lower(self, ch):
return unichr(unicodedb.tolower(ord(ch)))
+ def _title(self, ch):
+ return unichr(unicodedb.totitle(ord(ch)))
+
def _newlist_unwrapped(self, space, lst):
return space.newlist_unicode(lst)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit