Commit df781e6a authored by Fredrik Lundh's avatar Fredrik Lundh

reapplied darryl gallion's minimizing repeat fix. I'm still not 100%

sure about this one, but test #133283 now works even with the fix in
place, and so does the test suite.  we'll see what comes up...
parent cb9be939
...@@ -638,6 +638,8 @@ xyzabc ...@@ -638,6 +638,8 @@ xyzabc
(r'(?i)[m]+', 'MMM', SUCCEED, 'found', 'MMM'), (r'(?i)[m]+', 'MMM', SUCCEED, 'found', 'MMM'),
# bug 130748: ^* should be an error (nothing to repeat) # bug 130748: ^* should be an error (nothing to repeat)
(r'^*', '', SYNTAX_ERROR), (r'^*', '', SYNTAX_ERROR),
# bug 133283: minimizing repeat bug
(r'"(?:\\"|[^"])*?"', r'"\""', SUCCEED, 'found', r'"\"'),
] ]
try: try:
......
...@@ -245,7 +245,7 @@ if verbose: ...@@ -245,7 +245,7 @@ if verbose:
# implementation of repeated groups. # implementation of repeated groups.
test("sre.match('(x)*', 50000*'x').span()", (0, 50000), RuntimeError) test("sre.match('(x)*', 50000*'x').span()", (0, 50000), RuntimeError)
test("sre.match(r'(x)*y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) test("sre.match(r'(x)*y', 50000*'x'+'y').span()", (0, 50001), RuntimeError)
test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001))
from re_tests import * from re_tests import *
......
...@@ -1104,7 +1104,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) ...@@ -1104,7 +1104,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level)
/* see if the tail matches */ /* see if the tail matches */
state->repeat = rp->prev; state->repeat = rp->prev;
/* FIXME: the following fix doesn't always work (#133283) */ /* FIXME: the following fix doesn't always work (#133283) */
if (0 && rp->pattern[2] == 65535) { if (rp->pattern[2] == 65535) {
/* unbounded repeat */ /* unbounded repeat */
for (;;) { for (;;) {
i = SRE_MATCH(state, pattern, level + 1); i = SRE_MATCH(state, pattern, level + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment