Author: Matti Picus <matti.pi...@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): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit