[ python-Bugs-1058786 ] r'\10' as replacement pattern loops in
compilation
SourceForge.net
noreply at sourceforge.net
Tue Nov 2 14:07:22 CET 2004
Bugs item #1058786, was opened at 2004-11-02 13:39
Message generated for change (Comment added) made by jlgijsbers
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1058786&group_id=5470
Category: Regular Expressions
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Nick Maclaren (nmm1)
Assigned to: Fredrik Lundh (effbot)
Summary: r'\10' as replacement pattern loops in compilation
Initial Comment:
The following program loops under at least Solaris 9
on SPARC and Linux (kernel 2.6) in x86. From
tracebacks, it seems to be in the internal compilation
of the pattern r'\10'.
from re import compile
line = ""
pat = compile(12 * r'(\d+)')
ltarget = float(pat.sub(r'\10',line))
print ltarget
----------------------------------------------------------------------
>Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-11-02 14:07
Message:
Logged In: YES
user_id=469548
I get the following on Python 2.4/Linux 2.6.8, so it does
seem to be fixed:
>>> from re import compile
>>> line = ""
>>> pat = compile(12 * r'(\d+)')
>>> ltarget = float(pat.sub(r'\10',line))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: empty string for float()
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2004-11-02 14:00
Message:
Logged In: YES
user_id=38376
If you need a workaround for 2.2, use a sub callback:
http://effbot.org/zone/re-sub.htm#callbacks
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2004-11-02 13:58
Message:
Logged In: YES
user_id=38376
Cannot check this right now, but I'm 99% sure that this has
been fixed in 2.4.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1058786&group_id=5470
More information about the Python-bugs-list
mailing list