Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r69054:05d1dbaef6bd Date: 2014-02-02 21:39 -0800 http://bitbucket.org/pypy/pypy/changeset/05d1dbaef6bd/
Log: adapt to string based api diff --git a/pypy/module/_csv/interp_reader.py b/pypy/module/_csv/interp_reader.py --- a/pypy/module/_csv/interp_reader.py +++ b/pypy/module/_csv/interp_reader.py @@ -42,15 +42,8 @@ space = self.space field = field_builder.build() if self.numeric_field: - from rpython.rlib.rstring import ParseStringError - from rpython.rlib.rfloat import string_to_float self.numeric_field = False - try: - ff = string_to_float(field) - except ParseStringError as e: - from pypy.objspace.std.inttype import wrap_parsestringerror - raise wrap_parsestringerror(space, e, space.wrap(field)) - w_obj = space.wrap(ff) + w_obj = space.call_function(space.w_float, space.wrap(field)) else: w_obj = space.wrap(field) self.fields_w.append(w_obj) diff --git a/pypy/objspace/std/complextype.py b/pypy/objspace/std/complextype.py --- a/pypy/objspace/std/complextype.py +++ b/pypy/objspace/std/complextype.py @@ -1,4 +1,3 @@ -from rpython.tool.sourcetools import with_unicode_literals from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault from pypy.interpreter.error import OperationError, operationerrfmt from pypy.objspace.std.register_all import register_all @@ -19,7 +18,6 @@ register_all(vars(),globals()) -@with_unicode_literals def _split_complex(s): slen = len(s) if slen == 0: diff --git a/pypy/objspace/std/inttype.py b/pypy/objspace/std/inttype.py --- a/pypy/objspace/std/inttype.py +++ b/pypy/objspace/std/inttype.py @@ -94,8 +94,8 @@ if isinstance(e, InvalidBaseError): w_msg = space.wrap(e.msg) else: - w_msg = space.wrap('%s: %s' % (e.msg, - space.str_w(space.repr(w_source)))) + w_msg = space.wrap(u'%s: %s' % (unicode(e.msg), + space.unicode_w(space.repr(w_source)))) return OperationError(space.w_ValueError, w_msg) ## @unwrap_spec(w_x = WrappedDefault(0)) diff --git a/pypy/objspace/std/longtype.py b/pypy/objspace/std/longtype.py --- a/pypy/objspace/std/longtype.py +++ b/pypy/objspace/std/longtype.py @@ -67,8 +67,7 @@ s = unicode_to_decimal_w(space, w_value) else: try: - strval = space.bufferstr_w(w_value) - s = strval.decode('latin-1') + s = space.bufferstr_w(w_value) except OperationError: raise OperationError(space.w_TypeError, space.wrap("int() can't convert non-string " @@ -86,7 +85,7 @@ def string_to_w_long(space, w_longtype, w_source, string, base=10): try: bigint = rbigint.fromstr(string, base, ignore_l_suffix=True, - fname=u'int') + fname='int') except ParseStringError as e: from pypy.objspace.std.inttype import wrap_parsestringerror raise wrap_parsestringerror(space, e, w_source) 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 @@ -1144,9 +1144,7 @@ # # In CPython3 the call to PyUnicode_EncodeDecimal has been replaced to a call # to PyUnicode_TransformDecimalToASCII, which is much simpler. Here, we do the -# equivalent. -# -# Note that, differently than default, we return an *unicode* RPython string +# equivalent plus the final step of encoding the result to utf-8. def unicode_to_decimal_w(space, w_unistr): if not isinstance(w_unistr, W_UnicodeObject): raise operationerrfmt(space.w_TypeError, "expected unicode, got '%T'", @@ -1164,7 +1162,7 @@ except KeyError: pass result[i] = unichr(uchr) - return u''.join(result) + return unicodehelper.encode_utf8(space, u''.join(result)) _repr_function, _ = make_unicode_escape_function( _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit