diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2003-04-20 07:35:44 (GMT) |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2003-04-20 07:35:44 (GMT) |
commit | be733ee7fb7e2779851368221639807938413e7c (patch) | |
tree | f06eeded0408d0e6f738fc1d086616582c441d8a /Lib | |
parent | 48f3dcc93e57e75e43f9e1a82daa02d2c2f29ec8 (diff) | |
download | cpython-be733ee7fb7e2779851368221639807938413e7c.zip cpython-be733ee7fb7e2779851368221639807938413e7c.tar.gz cpython-be733ee7fb7e2779851368221639807938413e7c.tar.bz2 |
More work on bug #672491 and patch #712900.
I've applied a modified version of Greg Chapman's patch. I've included
the fixes without introducing the reorganization mentioned, for the sake
of stability. Also, the second fix mentioned in the patch don't fix the
mentioned problem anymore, because of the change introduced by patch
#720991 (by Greg as well). The new fix wasn't complicated though, and is
included as well.
As a note. It seems that there are other places that require the
"protection" of LASTMARK_SAVE()/LASTMARK_RESTORE(), and are just waiting
for someone to find how to break them. Particularly, I belive that every
recursion of SRE_MATCH() should be protected by these macros. I won't
do that right now since I'm not completely sure about this, and we don't
have much time for testing until the next release.
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/test/re_tests.py | 4 | ||||
-rw-r--r-- | Lib/test/test_sre.py | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/re_tests.py b/Lib/test/re_tests.py index 7b237ac..25b1229 100755 --- a/Lib/test/re_tests.py +++ b/Lib/test/re_tests.py @@ -655,6 +655,10 @@ xyzabc (r'^a*?$', 'foo', FAIL), # bug 470582: nested groups problem (r'^((a)c)?(ab)$', 'ab', SUCCEED, 'g1+"-"+g2+"-"+g3', 'None-None-ab'), + # another minimizing repeat problem (capturing groups in assertions) + ('^([ab]*?)(?=(b)?)c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'), + ('^([ab]*?)(?!(b))c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'), + ('^([ab]*?)(?<!(a))c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'), ] try: diff --git a/Lib/test/test_sre.py b/Lib/test/test_sre.py index db87162..453ee21 100644 --- a/Lib/test/test_sre.py +++ b/Lib/test/test_sre.py @@ -78,10 +78,12 @@ test(r"""sre.match(r'(a)|(b)', 'b').start(1)""", -1) test(r"""sre.match(r'(a)|(b)', 'b').end(1)""", -1) test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1)) -# bug described in patch 527371 +# bug described in patches 527371/672491 test(r"""sre.match(r'(a)?a','a').lastindex""", None) test(r"""sre.match(r'(a)(b)?b','ab').lastindex""", 1) test(r"""sre.match(r'(?P<a>a)(?P<b>b)?b','ab').lastgroup""", 'a') +test(r"""sre.match("(?P<a>a(b))", "ab").lastgroup""", 'a') +test(r"""sre.match("((a))", "a").lastindex""", 1) # bug 545855 -- This pattern failed to cause a compile error as it # should, instead provoking a TypeError. |