Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r95152:b972c7b3bc19
Date: 2018-09-22 19:39 +0300
http://bitbucket.org/pypy/pypy/changeset/b972c7b3bc19/
Log: use index instead of pos for errorhandler
diff --git a/pypy/interpreter/unicodehelper.py
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -1401,7 +1401,7 @@
if errorhandler:
res_8, newindex = errorhandler(
errors, public_encoding_name, 'malformed unicode',
- s, pos - 1, pos)
+ s, index, index+1)
if res_8:
for cp in rutf8.Utf8StringIterator(res_8):
if cp < 0xD800:
@@ -1409,7 +1409,7 @@
else:
errorhandler('strict', public_encoding_name,
'malformed unicode',
- s, pos-1, pos)
+ s, index, index+1)
else:
_STORECHAR32(result, ch, byteorder)
else:
@@ -1419,14 +1419,14 @@
if not allow_surrogates and 0xD800 <= ch < 0xE000:
res_8, newindex = errorhandler(
errors, public_encoding_name, 'surrogates not allowed',
- s, pos - 1, pos)
+ s, index, index+1)
for ch in rutf8.Utf8StringIterator(res_8):
if ch < 0xD800:
_STORECHAR32(result, ch, byteorder)
else:
errorhandler(
'strict', public_encoding_name, 'surrogates not
allowed',
- s, pos - 1, pos)
+ s, index, index+1)
if index != newindex: # Should be uncommon
index = newindex
pos = rutf8._pos_at_index(s, newindex)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit