Author: Armin Rigo <ar...@tunes.org>
Branch: unicode-utf8-re
Changeset: r93245:02e89a1160e5
Date: 2017-12-03 15:48 +0100
http://bitbucket.org/pypy/pypy/changeset/02e89a1160e5/

Log:    fix

diff --git a/rpython/rlib/rsre/rsre_core.py b/rpython/rlib/rsre/rsre_core.py
--- a/rpython/rlib/rsre/rsre_core.py
+++ b/rpython/rlib/rsre/rsre_core.py
@@ -799,7 +799,8 @@
             max_count = sys.maxint
             max = ctx.pat(ppos+2)
             if max != rsre_char.MAXREPEAT:
-                max_count = max
+                max_count = max - min
+                assert max_count >= 0
             nextppos = ppos + ctx.pat(ppos)
             result = MinRepeatOneMatchResult(nextppos, ppos+3, max_count,
                                              ptr, marks)
@@ -868,9 +869,10 @@
     # Else we really need to count how many times it matches.
     if maxcount != rsre_char.MAXREPEAT:
         # adjust end
-        end1 = ptr + maxcount
-        if end1 <= end:
-            end = end1
+        try:
+            end = ctx.next_n(ptr, maxcount, end)
+        except EndOfString:
+            pass
     op = ctx.pat(ppos)
     for op1, fre in unroll_fre_checker:
         if op1 == op:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to