Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mangled group names in RE_Match.groupdict() #821

Open
janrehberg opened this issue Aug 2, 2022 · 1 comment · Fixed by IronLanguages/ironpython3#1524
Open

Mangled group names in RE_Match.groupdict() #821

janrehberg opened this issue Aug 2, 2022 · 1 comment · Fixed by IronLanguages/ironpython3#1524

Comments

@janrehberg
Copy link

Description

In IronPython 2.7.12 (and 3.4.0-beta1) RE_Match.groupdict() contains the mangled names of orginally unnamed groups,
when both named and unnamed groups are present in the expression. CPython only lists the explicitly named groups.
This is, of course, trivial to work around, but I still thought it worth the report.

Expected behavior:

Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re; re.match('(?P<foo>.*)(.*)', 'bar').groupdict()
{'foo': 'bar'}

Actual behavior:

IronPython 2.7.12 DEBUG (2.7.12.1000)
[.NETFramework,Version=v4.5 on .NET Framework 4.8.4510.0 (64-bit)]
Type "help", "copyright", "credits" or "license" for more information.
>>> import re; re.match('(?P<foo>.*)(.*)', 'bar').groupdict()
{'foo': 'bar', '___PyRegexNameMangled2127356294': ''}
@slozier
Copy link
Contributor

slozier commented Aug 2, 2022

Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants