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.

classification
Title: re: Infinite loop with repeated empty alternative
Type: behavior Stage: resolved
Components: Regular Expressions Versions: Python 3.2
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ericp, ezio.melotti, mrabarnett
Priority: normal Keywords:

Created on 2013-03-28 23:50 by ericp, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg185474 - (view) Author: Eric Promislow (ericp) Date: 2013-03-28 23:50
>>> import re
>>> p = re.compile(r'^(?:\\"|.|)*?"', re.S|re.M)
>>> s = 'sub foo {\n\tprint "\n\t\tbar\n\t\t";\n}\n'
>>> m = p.findall(s)

Python doesn't return.

Dropping the last "|" in the pattern fixes this.

Regex engines in Perl, PHP, JS, and Ruby all handle
this regex.  Ref Komodo bug http://bugs.activestate.com/show_bug.cgi?id=98268
msg185958 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-04-03 21:34
I can reproduce on 3.2.3, but otherwise this work fine in the upcoming 3.2.4 and on 3.3+.
History
Date User Action Args
2022-04-11 14:57:43adminsetgithub: 61768
2013-04-03 21:34:14ezio.melottisetstatus: open -> closed
resolution: out of date
messages: + msg185958

stage: resolved
2013-03-29 18:22:38ezio.melottisetnosy: + ezio.melotti, mrabarnett
type: enhancement -> behavior
components: + Regular Expressions
2013-03-28 23:50:02ericpcreate