[pypy-commit] pypy unicode-utf8: fix translation
mattip
pypy.commits at gmail.com
Mon Dec 24 10:28:26 EST 2018
Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8
Changeset: r95528:e55276d37c08
Date: 2018-12-24 17:27 +0200
http://bitbucket.org/pypy/pypy/changeset/e55276d37c08/
Log: fix translation
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -332,6 +332,8 @@
for i in range(size):
pos = next_codepoint_pos(self.text, pos)
self.upos += 1
+ assert start >= 0
+ assert pos >= 0
chars = self.text[start:pos]
self.pos = pos
else:
@@ -351,7 +353,10 @@
if self.exhausted():
raise StopIteration
newpos = next_codepoint_pos(self.text, self.pos)
- ch = self.text[self.pos:newpos]
+ pos = self.pos
+ assert pos >= 0
+ assert newpos >= 0
+ ch = self.text[pos:newpos]
self.pos = newpos
self.upos += 1
return ch
@@ -361,7 +366,10 @@
if self.exhausted():
raise StopIteration
newpos = next_codepoint_pos(self.text, self.pos)
- return self.text[self.pos:newpos]
+ pos = self.pos
+ assert pos >= 0
+ assert newpos >= 0
+ return self.text[pos:newpos]
def find_newline_universal(self, limit):
# Universal newline search. Find any of \r, \r\n, \n
More information about the pypy-commit
mailing list