[pypy-commit] pypy unicode-utf8-py3: fix iterator stop condition
mattip
pypy.commits at gmail.com
Mon Oct 15 09:31:00 EDT 2018
Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95215:a8c58ad826e8
Date: 2018-10-15 16:30 +0300
http://bitbucket.org/pypy/pypy/changeset/a8c58ad826e8/
Log: fix iterator stop condition
diff --git a/pypy/interpreter/unicodehelper.py b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -276,6 +276,7 @@
for cp in rutf8.Utf8StringIterator(res_8):
if cp > 0xFF:
errorhandler("strict", 'latin1', msg, s, startindex, index)
+ raise RuntimeError('error handler should not have returned')
result.append(chr(cp))
if index != newindex: # Should be uncommon
index = newindex
diff --git a/rpython/rlib/rutf8.py b/rpython/rlib/rutf8.py
--- a/rpython/rlib/rutf8.py
+++ b/rpython/rlib/rutf8.py
@@ -760,6 +760,7 @@
self._pos = pos + 1
return ordch1
if pos + 1 >= len(code):
+ self._pos = pos + 1
return ordch1
ordch2 = ord(code[pos+1])
More information about the pypy-commit
mailing list