Issue 1018815: re.sub: two-digit group-reference hangs (original) (raw)

Issue1018815

Created on 2004-08-30 01:36 by jmdyck, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
diff jmdyck,2004-08-30 01:36 diff -C 2 sre_parse.py.ORIG sre_parse.py
Messages (5)
msg22270 - (view) Author: Michael Dyck (jmdyck) Date: 2004-08-30 01:36
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.
msg22271 - (view) Author: Michael Dyck (jmdyck) Date: 2004-08-30 01:45
Logged In: YES user_id=663727 It sounds like this bug was fixed by patch 1018386 just yesterday! (Please check.)
msg22272 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2004-09-03 11:38
Logged In: YES user_id=38376 Still there in 2.4a3, it seems.
msg22273 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2004-09-03 11:44
Logged In: YES user_id=38376 Assigning to Gustavo, who's reviewing #1018386 at the moment.
msg22274 - (view) Author: Gustavo Niemeyer (niemeyer) * (Python committer) Date: 2004-09-03 17:26
Logged In: YES user_id=7887 Patch #1018386 was applied, and really fixes this bug. Thanks folks!
History
Date User Action Args
2022-04-11 14:56:06 admin set github: 40843
2004-08-30 01:36:00 jmdyck create