[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-svn
Subject:    [pypy-commit] pypy unicode-utf8: fix translation
From:       mattip <pypy.commits () gmail ! com>
Date:       2018-12-24 15:28:26
Message-ID: 5c20fb1a.1c69fb81.34317.b4a6 () mx ! google ! com
[Download RAW message or body]

Author: Matti Picus <matti.picus@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
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic