test(r"""sre.match(r'(x)*y', 50000*'x'+'y').span()""",
(0, 50001), RuntimeError)
test(r"""sre.match(r'(x)*?y', 50000*'x'+'y').span()""",
- (0, 50001), RuntimeError)
+ (0, 50001)) # this works in 2.1
from re_tests import *
* 2000-10-24 fl really fixed assert_not; reset groups in findall
* 2000-12-21 fl fixed memory leak in groupdict
* 2001-01-02 fl properly reset pointer after failed assertion in MIN_UNTIL
+ * 2001-01-15 fl don't use recursion for unbounded MIN_UTIL
*
* Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
*
#ifndef SRE_RECURSIVE
-char copyright[] = " SRE 0.9.9 Copyright (c) 1997-2000 by Secret Labs AB ";
+char copyright[] = " SRE 0.9.9 Copyright (c) 1997-2001 by Secret Labs AB ";
#include "Python.h"
/* see if the tail matches */
state->repeat = rp->prev;
- i = SRE_MATCH(state, pattern, level + 1);
+ if (rp->pattern[2] == 65535) {
+ /* unbounded repeat */
+ for (;;) {
+ i = SRE_MATCH(state, pattern, level + 1);
+ if (i || ptr >= end)
+ break;
+ state->ptr = ++ptr;
+ }
+ } else
+ i = SRE_MATCH(state, pattern, level + 1);
if (i) {
/* free(rp); */
return i;
}
+
state->ptr = ptr;
state->repeat = rp;