Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r95000:631c31e88913
Date: 2018-08-12 14:14 -0700
http://bitbucket.org/pypy/pypy/changeset/631c31e88913/
Log: fix translation of temporary code
diff --git a/pypy/interpreter/unicodehelper.py
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -229,10 +229,12 @@
lgt = rutf8.check_utf8(s, allow_surrogates=allow_surrogates)
except rutf8.CheckError as e:
# XXX change this to non-recursive
- start = s[:e.pos]
+ pos = e.pos
+ assert pos >= 0
+ start = s[:pos]
ru, lgt = errorhandler(errors, 'utf8',
- 'surrogates not allowed', s, e.pos, e.pos + 1)
- end = utf8_encode_utf_8(s[e.pos+3:], errors, errorhandler,
+ 'surrogates not allowed', s, pos, pos + 1)
+ end = utf8_encode_utf_8(s[pos+3:], errors, errorhandler,
allow_surrogates=allow_surrogates)
s = start + ru + end
return s
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit