Quentin Wenger <wenger.quen...@bluewin.ch> added the comment: I prove my point that the decoding to string is arbitrary:
``` >>> import re >>> orig_name = "Ř" >>> orig_ch = orig_name.encode("cp1250") # Because why not? >>> name = list(re.match(b"(?P<" + orig_ch + b">)", b"").groupdict().keys())[0] >>> name == orig_name False >>> name 'Ø' >>> name.encode("latin-1") == orig_ch True ``` For any dynamically-constructed bytes regex pattern, a string group name as output is unusable. Only after latin-1-reencoding can it be safely compared. This latin-1 choice is arbitrary. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40980> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com