[pypy-commit] pypy unicode-utf8: fix recursive call to decode_object, set errorhandler
mattip
pypy.commits at gmail.com
Wed Sep 12 08:34:45 EDT 2018
Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8
Changeset: r95108:f33f0bb4a73e
Date: 2018-09-12 15:33 +0300
http://bitbucket.org/pypy/pypy/changeset/f33f0bb4a73e/
Log: fix recursive call to decode_object, set errorhandler
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
@@ -628,8 +628,10 @@
else:
errors = None
+ state = space.fromcache(CodecState)
result, _, length, byteorder = unicodehelper.str_decode_utf_32_helper(
- string, errors, final=True, errorhandler=None, byteorder=byteorder)
+ string, errors, final=True, errorhandler=state.decode_error_handler,
+ byteorder=byteorder)
if pbyteorder is not None:
pbyteorder[0] = rffi.cast(rffi.INT_real, byteorder)
return space.newutf8(result, length)
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
@@ -452,9 +452,7 @@
return self._value
def utf8_w(self, space):
- # Use the default encoding.
- encoding = getdefaultencoding(space)
- return space.utf8_w(decode_object(space, self, encoding, None))
+ return self._value
def buffer_w(self, space, flags):
space.check_buf_flags(flags, True)
More information about the pypy-commit
mailing list