[pypy-commit] pypy unicode-utf8-re: fix for test_ext_opcode
arigo
pypy.commits at gmail.com
Sun Dec 3 09:24:36 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: unicode-utf8-re
Changeset: r93243:19e4a5fa4aa4
Date: 2017-12-03 15:24 +0100
http://bitbucket.org/pypy/pypy/changeset/19e4a5fa4aa4/
Log: fix for test_ext_opcode
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
@@ -627,7 +627,7 @@
if (ptr == ctx.end or
not rsre_char.category_dispatch(ctx.pat(ppos), ctx.str(ptr))):
return
- ptr += 1
+ ptr = ctx.next(ptr)
ppos += 1
elif op == OPCODE_GROUPREF:
@@ -887,7 +887,7 @@
if end1 <= end:
end = end1
while ptr < end and sre_match(ctx, ppos, ptr, marks) is not None:
- ptr += 1
+ ptr = ctx.next(ptr)
return ptr
@specializectx
diff --git a/rpython/rlib/rsre/test/test_ext_opcode.py b/rpython/rlib/rsre/test/test_ext_opcode.py
--- a/rpython/rlib/rsre/test/test_ext_opcode.py
+++ b/rpython/rlib/rsre/test/test_ext_opcode.py
@@ -5,6 +5,7 @@
from rpython.rlib.rsre import rsre_core
from rpython.rlib.rsre.rsre_char import MAXREPEAT
+from rpython.rlib.rsre.test.support import match, Position
# import OPCODE_XX as XX
for name, value in rsre_core.__dict__.items():
@@ -17,10 +18,10 @@
# it's a valid optimization because \1 is always one character long
r = [MARK, 0, ANY, MARK, 1, REPEAT_ONE, 6, 0, MAXREPEAT,
GROUPREF, 0, SUCCESS, SUCCESS]
- assert rsre_core.match(r, "aaa").match_end == 3
+ assert match(r, "aaa").match_end == Position(3)
def test_min_repeat_one_with_backref():
# Python 3.5 compiles "(.)\1*?b" using MIN_REPEAT_ONE
r = [MARK, 0, ANY, MARK, 1, MIN_REPEAT_ONE, 6, 0, MAXREPEAT,
GROUPREF, 0, SUCCESS, LITERAL, 98, SUCCESS]
- assert rsre_core.match(r, "aaab").match_end == 4
+ assert match(r, "aaab").match_end == Position(4)
More information about the pypy-commit
mailing list