Author: Manuel Jacob Branch: refactor-str-types Changeset: r64785:1fa825c8c78d Date: 2013-06-04 22:25 +0200 http://bitbucket.org/pypy/pypy/changeset/1fa825c8c78d/
Log: Fix. diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py --- a/pypy/module/cpyext/unicodeobject.py +++ b/pypy/module/cpyext/unicodeobject.py @@ -12,7 +12,7 @@ from pypy.module.cpyext.stringobject import PyString_Check from pypy.module.sys.interp_encoding import setdefaultencoding from pypy.module._codecs.interp_codecs import CodecState -from pypy.objspace.std import unicodeobject, bytesobject +from pypy.objspace.std import unicodeobject from rpython.rlib import runicode from rpython.tool.sourcetools import func_renamer import sys @@ -684,9 +684,12 @@ str = space.unicode_w(w_str) substr = space.unicode_w(w_substr) if rffi.cast(lltype.Signed, direction) <= 0: - return bytesobject.stringstartswith(str, substr, start, end) + w_ret = space.call_method(w_str, "startswith", w_substr, + space.wrap(start), space.wrap(end)) else: - return bytesobject.stringendswith(str, substr, start, end) + w_ret = space.call_method(w_str, "endswith", w_substr, + space.wrap(start), space.wrap(end)) + return space.int_w(w_ret) @cpython_api([PyObject, PyObject, Py_ssize_t, Py_ssize_t], Py_ssize_t, error=-1) def PyUnicode_Count(space, w_str, w_substr, start, end): diff --git a/pypy/module/micronumpy/stdobjspace.py b/pypy/module/micronumpy/stdobjspace.py --- a/pypy/module/micronumpy/stdobjspace.py +++ b/pypy/module/micronumpy/stdobjspace.py @@ -7,5 +7,5 @@ def register_delegates(typeorder): typeorder[interp_boxes.W_StringBox] = [ - (bytesobject.W_StringObject, delegate_stringbox2stringobj), + (bytesobject.W_BytesObject, delegate_stringbox2stringobj), ] 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 @@ -434,8 +434,11 @@ return space.wrap(value) def descr_lower(self, space): - self = self._value - return space.wrap(self.lower()) + value = self._val() + builder = self._builder(len(value)) + for i in range(len(value)): + builder.append(self._lower(value[i])) + return self._new(builder.build()) def descr_partition(self, space, w_sub): value = self._val() @@ -822,8 +825,11 @@ return self._new(buf.build()) def descr_upper(self, space): - self = self._value - return space.wrap(self.upper()) + value = self._val() + builder = self._builder(len(value)) + for i in range(len(value)): + builder.append(self._upper(value[i])) + return self._new(builder.build()) @unwrap_spec(width=int) def descr_zfill(self, space, width): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit