[ubuntu-mono] [Bug 626489] Re: regex match.groupdict() returns wrong values
Kenji Noguchi
626489 at bugs.launchpad.net
Mon Aug 30 06:52:28 UTC 2010
Preliminary investigation revealed that the regex bug was not of ironpython but mono.
Test case worked fine with MS System.dll dropped in.
--
regex match.groupdict() returns wrong values
https://bugs.launchpad.net/bugs/626489
You received this bug notification because you are a member of Ubuntu
CLI/Mono Uploaders, which is subscribed to ironpython in ubuntu.
Status in “ironpython” package in Ubuntu: New
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'}
More information about the Ubuntu-mono
mailing list