regex match.groupdict() returns wrong values

Bug #626489 reported by Kenji Noguchi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ironpython (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: ironpython

match object's groupdict() returns wrong key & value combinations.
Attached is a test case to reproduce the problem.

Works:
IronPython 2.6 for .NET2.0 SP1 on Windows XP SP3 32bit
CPython2.6 on Ubuntu 10.04LTS i386
CPython2.6 on Ubuntu 10.04LTS x86_64

Does'nt work:
ironpython 2.6~beta2-2 on Ubuntu 10.04.1 LTS i386
ironpython 2.6~beta2-2 on Ubuntu 10.04.1 LTS x86_64

#Test case
import re
p = re.compile(r'''
             (?P<name>[\w\+]+)://
             (?:
                 (?P<username>[^:/]*)
                 (?::(?P<password>[^/]*))?
             @)?
             (?:
                 (?P<host>[^/:]*)
                 (?::(?P<port>[^/]*))?
             )?
             (?:/(?P<database>.*))?
             '''
             , re.X)

m = p.match('http://user:pass@localhost:666/xyz')
print m.groups()
print m.groupdict()

# expected result. dict keys in arbitrary order
('http', 'user', 'pass', 'localhost', '666', 'xyz')
{'username': 'user', 'protocol': 'http', 'database': 'xyz', 'host': 'localhost', 'password': 'pass', 'port': '666'}

# results on ubuntu 10.04LTS i386/x86_64
('http', 'user', 'pass', 'localhost', '666', 'xyz')
{'username': 'http://user:pass@localhost:666/xyz', 'port': 'xyz', 'protocol': 'http', 'database': 'user', 'host': 'localhost', 'password': '666'}

Revision history for this message
Kenji Noguchi (knoguchi) wrote :

Preliminary investigation revealed that the regex bug was not of ironpython but mono.
Test case worked fine with MS System.dll dropped in.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.