Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r95684:0be26dc39a59
Date: 2019-01-21 14:00 +0200
http://bitbucket.org/pypy/pypy/changeset/0be26dc39a59/
Log: unicodeobject.text_w must be valid unicode
Can we speed this up by storing a _valid state when creating the
object?
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
@@ -87,7 +87,8 @@
return space.newint(uid)
def text_w(self, space):
- return self._utf8
+ eh = unicodehelper.decode_error_handler(space)
+ return unicodehelper.utf8_encode_utf_8(self._utf8, 'utf-8', eh)
def utf8_w(self, space):
return self._utf8
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit