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

SourceForge.net noreply at sourceforge.net
Fri Sep 3 13:38:11 CEST 2004


Bugs item #1018815, was opened at 2004-08-30 03:36
Message generated for change (Comment added) made by effbot
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: Fredrik Lundh (effbot)
Date: 2004-09-03 13:38

Message:
Logged In: YES 
user_id=38376

Still there in 2.4a3, it seems.

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

Comment By: Michael Dyck (jmdyck)
Date: 2004-08-30 03: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