[pypy-commit] pypy refactor-str-types: Add fast path for app-level str.lower() and str.upper().

Manuel Jacob noreply at buildbot.pypy.org
Fri Jan 17 10:50:49 CET 2014


Author: Manuel Jacob
Branch: refactor-str-types
Changeset: r68708:705202fc153f
Date: 2014-01-17 10:50 +0100
http://bitbucket.org/pypy/pypy/changeset/705202fc153f/

Log:	Add fast path for app-level str.lower() and str.upper().

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
@@ -684,6 +684,12 @@
             return self_as_uni._new(res)
         return self._StringMethods_descr_replace(space, w_old, w_new, count)
 
+    def descr_lower(self, space):
+        return W_BytesObject(self._value.lower())
+
+    def descr_upper(self, space):
+        return W_BytesObject(self._value.upper())
+
     def _join_return_one(self, space, w_obj):
         return (space.is_w(space.type(w_obj), space.w_str) or
                 space.is_w(space.type(w_obj), space.w_unicode))


More information about the pypy-commit mailing list