[Python-checkins] python/dist/src/Lib/test re_tests.py,1.34,1.35 test_sre.py,1.40,1.41

niemeyer@users.sourceforge.net niemeyer@users.sourceforge.net
Sun, 20 Apr 2003 00:35:46 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv16123/Lib/test

Modified Files:
	re_tests.py test_sre.py 
Log Message:
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.


Index: re_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/re_tests.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** re_tests.py	24 Feb 2003 01:18:35 -0000	1.34
--- re_tests.py	20 Apr 2003 07:35:44 -0000	1.35
***************
*** 656,659 ****
--- 656,663 ----
      # 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'),
  ]
  

Index: test_sre.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** test_sre.py	19 Apr 2003 08:37:24 -0000	1.40
--- test_sre.py	20 Apr 2003 07:35:44 -0000	1.41
***************
*** 79,86 ****
  test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1))
  
! # bug described in patch 527371
  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')
  
  # bug 545855 -- This pattern failed to cause a compile error as it
--- 79,88 ----
  test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1))
  
! # 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