[Python-bugs-list] [ python-Bugs-581080 ] Provoking infinite scanner loops
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 06 Nov 2002 19:30:59 -0800
Bugs item #581080, was opened at 2002-07-13 19:32
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=581080&group_id=5470
Category: Regular Expressions
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Fredrik Lundh (effbot)
Summary: Provoking infinite scanner loops
Initial Comment:
>From c.l.py:
"""
From: Jane Austine
Sent: Saturday, July 13, 2002 6:01 AM
To: python-list@python.org
Subject: sre.finditer break down: is this a bug?
Newly added function sre.finditer and
(matchedObject.)finditer break down and the system
crushes on win32 when requested for next() after
StopIteration.
see:
>> import sre
>> fi=sre.finditer(r'\s','a b')
>> fi.next()
>> fi.next()
>> fi.next() #system halts for ever.
--
"""
The semantics of the underlying calliterobject aren't
clear to me in this endcase, and I've raised that issue
on c.l.py.
But regardless of how that's resolved, it's easy to
provoke the bad behavior without using finditer, and
that should be fixed:
>>> import re
>>> s = re.compile(r'\s').scanner
>>> t = s('a b').search
>>> t()
<_sre.SRE_Match object at 0x00679F70>
>>> t()
>>> t()
>>> t()
and there it's hung.
----------------------------------------------------------------------
>Comment By: Gustavo Niemeyer (niemeyer)
Date: 2002-11-07 03:30
Message:
Logged In: YES
user_id=7887
Fixed in the following CVS revisions:
Misc/NEWS: 1.515->1.516
Modules/_sre.c: 2.84->2.85
Thank you, Tim!
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-07-13 19:35
Message:
Logged In: YES
user_id=31435
Oops -- I meant I raised the calliterobject issue on Python-
Dev, not on c.l.py.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=581080&group_id=5470