This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients Arfrever, arigo, eli.bendersky, ezio.melotti, larry, mrabarnett, pitrou, python-dev, serhiy.storchaka, tim.peters
Date 2013-08-10.17:51:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376157105.56.0.178403871169.issue18647@psf.upfronthosting.co.za>
In-reply-to
Content
Serhiy, yes, I know the regexp you gave takes exponential time.  But:

1. This appears to have nothing to do with repeated 0-length matches.  I gave you an example of a very similar regexp that also takes exponential time, but never makes any 0-length sub-match.

2. Matthew said that Python's engine is not robust against _unbounded_ repeated matching of an empty sub-match, and so "That's the reason for the up-front check".  I was asking for an example of _that_ behavior.  I still haven't seen one.

My goal here is to understand why we're doing this check at all.  If Python's engine cannot in fact be provoked into an infinite loop, the check has at best very little value, as there are many ways to provoke exponential-time behavior, and the possibility of a repeated 0-length sub-match doesn't appear to have much (if anything) to do with it.

(By the way, exponential-time regexps can't always be rewritten to take linear time, although it takes gimmicks like back references to create examples that are inherently expensive.)
History
Date User Action Args
2013-08-10 17:51:45tim.peterssetrecipients: + tim.peters, arigo, pitrou, larry, ezio.melotti, mrabarnett, Arfrever, eli.bendersky, python-dev, serhiy.storchaka
2013-08-10 17:51:45tim.peterssetmessageid: <1376157105.56.0.178403871169.issue18647@psf.upfronthosting.co.za>
2013-08-10 17:51:45tim.peterslinkissue18647 messages
2013-08-10 17:51:45tim.peterscreate