]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
reapplied darryl gallion's minimizing repeat fix. I'm still not 100%
authorFredrik Lundh <fredrik@pythonware.com>
Mon, 2 Jul 2001 19:54:28 +0000 (19:54 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Mon, 2 Jul 2001 19:54:28 +0000 (19:54 +0000)
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...

Lib/test/re_tests.py
Lib/test/test_sre.py
Modules/_sre.c

index 7c5dc890d919bb106d3c2b939459b94db0fc37b6..d69b324c54ba0883b9ea887e1af990ca4df252a9 100755 (executable)
@@ -638,6 +638,8 @@ xyzabc
     (r'(?i)[m]+', 'MMM', SUCCEED, 'found', 'MMM'),
     # bug 130748: ^* should be an error (nothing to repeat)
     (r'^*', '', SYNTAX_ERROR),
+    # bug 133283: minimizing repeat bug
+    (r'"(?:\\"|[^"])*?"', r'"\""', SUCCEED, 'found', r'"\"'),
 ]
 
 try:
index f133c988f0031b12114de9a6dbc2093f2acae689..e266d14d5ef7420c8ff7fd290939a0478ec4ff97 100644 (file)
@@ -245,7 +245,7 @@ if verbose:
 # implementation of repeated groups.
 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))
 
 from re_tests import *
 
index 16629bc2eb90949bba7cbdeeafc7014d90acdc8c..910e51f4fcfac70ade2d72acb68d30ce5220e3d1 100644 (file)
@@ -1104,7 +1104,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level)
             /* see if the tail matches */
             state->repeat = rp->prev;
             /* FIXME: the following fix doesn't always work (#133283) */
-            if (0 && rp->pattern[2] == 65535) {
+            if (rp->pattern[2] == 65535) {
                 /* unbounded repeat */
                 for (;;) {
                     i = SRE_MATCH(state, pattern, level + 1);