Author: Matti Picus <matti.pi...@gmail.com>
Branch: py3.6
Changeset: r96305:2158401a5481
Date: 2019-03-13 07:26 +0200
http://bitbucket.org/pypy/pypy/changeset/2158401a5481/

Log:    merge default into branch

diff --git a/rpython/rlib/rsre/rsre_utf8.py b/rpython/rlib/rsre/rsre_utf8.py
--- a/rpython/rlib/rsre/rsre_utf8.py
+++ b/rpython/rlib/rsre/rsre_utf8.py
@@ -40,17 +40,23 @@
     prev_indirect = prev
 
     def next_n(self, position, n, end_position):
-        for i in range(n):
+        i = 0
+        # avoid range(n) since n can be quite large
+        while i < n:
             if position >= end_position:
                 raise EndOfString
             position = rutf8.next_codepoint_pos(self._utf8, position)
+            i += 1
         return position
 
     def prev_n(self, position, n, start_position):
-        for i in range(n):
+        i = 0
+        # avoid range(n) since n can be quite large
+        while i < n:
             if position <= start_position:
                 raise EndOfString
             position = rutf8.prev_codepoint_pos(self._utf8, position)
+            i += 1
         assert position >= 0
         return position
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to