Resolution: was Re: [Python-Dev] re.finditer

Kevin J. Butler python-kbutler at sabaydi.com
Fri Oct 3 14:13:16 EDT 2003


Summary: bug 817234

http://sourceforge.net/tracker/index.php?func=detail&aid=817234&group_id=5470&atid=105470

in Python 2.3 and 2.3.1, finditer does not raise StopIteration if the 
end of the string matches with an empty match.

That is, the following code will loop forever:

 >>> import re
 >>> i = re.finditer( ".*", "asdf" )
 >>> for m in i: print m.span()
...
(0, 4)
(4, 4)
(4, 4)
(4, 4)
(4, 4)
(4, 4)
(4, 4)

Seo Sanghyeon posted what appears to be a correct fix. The code was introduced in the fix for bug 581080 http://sourceforge.net/tracker/index.php?func=detail&aid=581080&group_id=5470&atid=105470
but removing this line does not re-introduce that bug.

Thanks, and kudos to Seo...

kb





More information about the Python-Dev mailing list