Author: Matti Picus <matti.pi...@gmail.com> Branch: unicode-utf8-py3 Changeset: r94792:63fcd825e9f2 Date: 2018-07-01 00:05 -0500 http://bitbucket.org/pypy/pypy/changeset/63fcd825e9f2/
Log: pass more module/_io tests diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -1715,6 +1715,9 @@ def convert_to_w_unicode(self, w_obj): return w_obj.convert_to_w_unicode(self) + def realunicode_w(self, w_obj): + return w_obj.utf8_w(self).decode('utf8') + def utf8_0_w(self, w_obj): "Like utf8_w, but rejects strings with NUL bytes." from rpython.rlib import rstring diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py --- a/pypy/module/_io/interp_textio.py +++ b/pypy/module/_io/interp_textio.py @@ -739,7 +739,7 @@ def _read(self, space, size): remaining = size - builder = UnicodeBuilder(size) + builder = StringBuilder(size) # Keep reading chunks until we have n characters to return while remaining > 0: @@ -825,7 +825,7 @@ result = builder.build() lgt = get_utf8_length(result) - return space.newutf8(result, lgt) + return (result, lgt, lgt) # _____________________________________________________________ # write methods diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py --- a/pypy/objspace/std/objspace.py +++ b/pypy/objspace/std/objspace.py @@ -387,11 +387,11 @@ if isinstance(s, unicode): s, lgt = s.encode('utf8'), len(s) elif isinstance(s, str): - s, lgt, chk = str_decode_utf8(s, "string", True, None, + s, uf8lgt, lgt = str_decode_utf8(s, "string", True, None, allow_surrogates=True) elif isinstance(s, tuple): # result of decode_utf8 - s, lgt, chk = s + s, utf8lgt, lgt = s else: # XXX what is s ? lgt = rutf8.check_utf8(s, True) 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 @@ -587,7 +587,7 @@ return space.newbool(cased) def descr_isidentifier(self, space): - return space.newbool(_isidentifier(self._value)) + return space.newbool(_isidentifier(self._utf8.decode('utf8'))) def descr_startswith(self, space, w_prefix, w_start=None, w_end=None): start, end = self._unwrap_and_compute_idx_params(space, w_start, w_end) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit