This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author matpi
Recipients ezio.melotti, matpi, mrabarnett
Date 2020-06-14.21:03:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1592168614.73.0.0415067769111.issue40980@roundup.psfhosted.org>
In-reply-to
Content
I noticed that match.groupdict() returns string keys, even for a bytes regex:

```
>>> import re
>>> re.match(b"(?P<a>)", b"").groupdict()
{'a': b''}
```

This seems somewhat strange, because string and bytes matching in re are kind of two separate parts, cf. doc:

> Both patterns and strings to be searched can be Unicode strings (str) as well as 8-bit strings (bytes). However, Unicode strings and 8-bit strings cannot be mixed: that is, you cannot match a Unicode string with a byte pattern or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string.
History
Date User Action Args
2020-06-14 21:03:34matpisetrecipients: + matpi, ezio.melotti, mrabarnett
2020-06-14 21:03:34matpisetmessageid: <1592168614.73.0.0415067769111.issue40980@roundup.psfhosted.org>
2020-06-14 21:03:34matpilinkissue40980 messages
2020-06-14 21:03:34matpicreate