[pypy-commit] pypy default: change test of utf8 length, len(u) != codepoints on narrow builds
mattip
pypy.commits at gmail.com
Sat Mar 9 13:42:49 EST 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r96228:ead9c5bf9d9c
Date: 2019-03-09 20:43 +0200
http://bitbucket.org/pypy/pypy/changeset/ead9c5bf9d9c/
Log: change test of utf8 length, len(u) != codepoints on narrow builds
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
@@ -44,7 +44,7 @@
if not we_are_translated():
try:
# best effort, too expensive to handle surrogates
- ulength = len(utf8str.decode('utf8'))
+ ulength = rutf8.codepoints_in_utf(utf8str)
except:
ulength = length
assert ulength == length
More information about the pypy-commit
mailing list