[pypy-commit] pypy default: partially restore test removed in baef7e3e3ac0
mattip
pypy.commits at gmail.com
Mon Feb 18 10:07:41 EST 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r96062:7693e4a720ad
Date: 2019-02-18 16:05 +0200
http://bitbucket.org/pypy/pypy/changeset/7693e4a720ad/
Log: partially restore test removed in baef7e3e3ac0
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
@@ -41,6 +41,15 @@
self._utf8 = utf8str
self._length = length
self._index_storage = rutf8.null_storage()
+ if not we_are_translated():
+ try:
+ # best effort, too expensive to handle surrogates
+ ulength = len(utf8str.decode('utf8'))
+ except:
+ ulength = length
+ assert ulength == length
+
+
@staticmethod
def from_utf8builder(builder):
More information about the pypy-commit
mailing list