re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?
python at mrabarnett.plus.com
Tue Feb 14 21:08:57 EST 2012
On 15/02/2012 01:43, Devin Jeanpierre wrote:
> On Tue, Feb 14, 2012 at 1:05 PM, MRAB<python at mrabarnett.plus.com>
>>> And yeah, even something as crazy as ()* works, but as soon as
>>> it becomes (a*)* it doesn't work. Weird.
>> I think it's a combination of warning the user about something
>> that's pointless, as in the case of "$*", and producing a pattern
>> which could cause the internal regex engine to get stuck in an
>> infinite loop.
> Considering that ()* works fine, I can't imagine it ever gets stuck
> in infinite loops. But I admit I am too lazy to check against the
> Also, complete failure is an exceptionally (heh) poor way of warning
> people about stuff. I hope that's not really it.
There is one place in the re engine where it tries to avoid getting
stuck in an infinite loop because of a zero-width match, but the fix
inadvertently causes another bug. It's described in issue #1647489.
More information about the Python-list