@@ -169,7 +169,6 @@ def test_re_match(self):
169169 self .assertEqual (pat .match ('ac' ).group (1 , 'b2' , 3 ), ('a' , None , 'c' ))
170170
171171 def test_re_groupref_exists (self ):
172- return # not yet
173172 self .assertEqual (re .match ('^(\()?([^()]+)(?(1)\))$' , '(a)' ).groups (),
174173 ('(' , 'a' ))
175174 self .assertEqual (re .match ('^(\()?([^()]+)(?(1)\))$' , 'a' ).groups (),
@@ -405,19 +404,20 @@ def test_bug_418626(self):
405404 self .assertEqual (re .match ('.*?cd' , 5000 * 'ab' + 'c' + 5000 * 'ab' + 'cde' ).end (0 ),
406405 20003 )
407406 self .assertEqual (re .match ('.*?cd' , 20000 * 'abc' + 'de' ).end (0 ), 60001 )
408- # non-simple '*?' still recurses and hits the recursion limit
409- self .assertRaises (RuntimeError , re .search , '(a|b)*?c' , 10000 * 'ab' + 'cd' )
407+ # non-simple '*?' still used to hit the recursion limit, before the
408+ # non-recursive scheme was implemented.
409+ self .assertEqual (re .search ('(a|b)*?c' , 10000 * 'ab' + 'cd' ).end (0 ), 20001 )
410410
411411 def test_bug_612074 (self ):
412412 pat = u"[" + re .escape (u"\u2039 " )+ u"]"
413413 self .assertEqual (re .compile (pat ) and 1 , 1 )
414414
415415 def test_stack_overflow (self ):
416- # nasty case that overflows the straightforward recursive
416+ # nasty cases that used to overflow the straightforward recursive
417417 # implementation of repeated groups.
418- self .assertRaises ( RuntimeError , re .match , '(x)*' , 50000 * 'x' )
419- self .assertRaises ( RuntimeError , re .match , '(x)*y' , 50000 * 'x' + 'y' )
420- self .assertRaises ( RuntimeError , re .match , '(x)*?y' , 50000 * 'x' + 'y' )
418+ self .assertEqual ( re .match ( '(x)*' , 50000 * 'x' ). group ( 1 ), 'x' )
419+ self .assertEqual ( re .match ( '(x)*y' , 50000 * 'x' + 'y' ). group ( 1 ), 'x ' )
420+ self .assertEqual ( re .match ( '(x)*?y' , 50000 * 'x' + 'y' ). group ( 1 ), 'x ' )
421421
422422 def test_scanner (self ):
423423 def s_ident (scanner , token ): return token
0 commit comments