[ python-Bugs-1018815 ] re.sub: two-digit group-reference hangs

SourceForge.net noreply at sourceforge.net
Mon Aug 30 03:45:02 CEST 2004


Bugs item #1018815, was opened at 2004-08-29 18:36
Message generated for change (Comment added) made by jmdyck
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1018815&group_id=5470

Category: Regular Expressions
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Dyck (jmdyck)
Assigned to: Fredrik Lundh (effbot)
Summary: re.sub: two-digit group-reference hangs

Initial Comment:
Python 2.3.3 (#2, Feb 17 2004, 11:45:40)
[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2

I think this affects 2.4 as well.

If you invoke re.sub(), and the replacement contains a
two-digit group-reference, it hangs. E.g. try

print re.sub( r'(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)', 
r'\10', 'abcdefghijklm' )

Problem is infinite loop in sre_parse.py.

I've attached a change that I think fixes it.

----------------------------------------------------------------------

>Comment By: Michael Dyck (jmdyck)
Date: 2004-08-29 18:45

Message:
Logged In: YES 
user_id=663727

It sounds like this bug was fixed by patch 1018386 just
yesterday!

(Please check.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1018815&group_id=5470


More information about the Python-bugs-list mailing list