[issue11665] Regexp findall freezes

2011-04-05 Thread STINNER Victor
STINNER Victor added the comment: Ok. -- resolution: -> invalid status: open -> closed ___ Python tracker ___ ___ Python-bugs-list m

[issue11665] Regexp findall freezes

2011-04-05 Thread Viktor Ferenczi
Viktor Ferenczi added the comment: I found this ugly regexp in old code and optimized this, certainly. I'll need to search for more of this in the code to make sure it won't freeze next time. I think you can close this ticket, since it is only another way to write an infinite loop in Python,

[issue11665] Regexp findall freezes

2011-03-25 Thread Matthew Barnett
Matthew Barnett added the comment: Alex is correct. This part: [^<>]* can match an empty string, and it's nested with a repeated group. It stalls, repeatedly matching an empty string. Incidentally, my regex implementation (available on PyPI) returns []. --

[issue11665] Regexp findall freezes

2011-03-25 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, mrabarnett ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue11665] Regexp findall freezes

2011-03-24 Thread STINNER Victor
STINNER Victor added the comment: If I read correctly '(<(?:(?:[^<>]*)|(?:"[^"]*"))*>)', it is something like (A*|B)*. Regex like (A*)* is *very* slow. It can easily be optimized to A*. Or for (A*|B)* => (A|B)*. So '(<(?:(?:[^<>]*)|(?:"[^"]*"))*>)' can be optimized to '(<(?:(?:[^<>])|(?:"[^"

[issue11665] Regexp findall freezes

2011-03-24 Thread Alex Gaynor
Alex Gaynor added the comment: Yes, this is known as catastrophic backtracking, and there isn't really a solution for it, some regexps can't be efficiently matched. -- nosy: +alex ___ Python tracker _

[issue11665] Regexp findall freezes

2011-03-24 Thread Viktor Ferenczi
Viktor Ferenczi added the comment: Fixing my typo in this bug report: "Finding all matches of a regular expression freezes:" (I'm not allowed to edit the report's body itself.) -- ___ Python tracker

[issue11665] Regexp findall freezes

2011-03-24 Thread Viktor Ferenczi
New submission from Viktor Ferenczi : Finding all matches of a expression freezes: {{{ fviktor@sirius:~$ python3.2 Python 3.2 (r32:88445, Mar 8 2011, 01:24:57) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> text = '\\ = 0) & (la