[Python-bugs-list] [ python-Bugs-470582 ] sre bug with nested groups

noreply@sourceforge.net noreply@sourceforge.net
Wed, 06 Nov 2002 06:28:08 -0800


Bugs item #470582, was opened at 2001-10-12 14:23
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=470582&group_id=5470

Category: Regular Expressions
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Markus F.X.J. Oberhumer (mfx)
Assigned to: Fredrik Lundh (effbot)
Summary: sre bug with nested groups

Initial Comment:
sre incorrectly assigns non-matched inner groups.

See m.group(2) in the example below.

This bug seems to be present in all sre versions
(tested with python 1.6.x, 2.0.x, 2.1.x and 2.2a4).

Markus

P.S. this seems not related to SF bug #468169



Script started on Tue Oct  9 05:09:28 2001
mfx@laetitia:~/tmp > cat sre_bug.py
import sys, pre, sre

def time2ms(re, time):
    m = re.search(r"^((\d)\:)?(\d\d)\.(\d\d\d)$", time)
    print re.__name__
    if hasattr(re, "__version__"):
        print re.__version__
    print m.groups()

print sys.version
time2ms(pre, "34.123")
time2ms(sre, "34.123")

mfx@laetitia:~/tmp > pyhon2.2a4 sre_bug.py

2.2a4 (#1, Sep 29 2001, 23:40:47)
[GCC 2.95.4 20010902 (Debian prerelease)]
pre
(None, None, '34', '123')
sre
2.1.1
(None, '3', '34', '123')

Script done on Tue Oct  9 05:09:45 2001


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

>Comment By: Gustavo Niemeyer (niemeyer)
Date: 2002-11-06 14:28

Message:
Logged In: YES 
user_id=7887

Fixed in CVS in the following revisions:

Lib/test/re_tests.py:1.30->1.31 
Lib/test/test_sre.py:1.37->1.38 
Misc/NEWS:1.511->1.512 
Modules/_sre.c:2.83->2.84

Thank you very much!

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

Comment By: Greg Chapman (glchapman)
Date: 2002-03-11 13:51

Message:
Logged In: YES 
user_id=86307

I posted a patch (527371) for this here:

http://sourceforge.net/tracker/?
func=detail&aid=527371&group_id=5470&atid=305470

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

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