[issue23091] unpacked keyword arguments are not unicode normalized

2014-12-19 Thread S. Andrew Sheppard
S. Andrew Sheppard added the comment: Fair enough. For future reference by anyone coming across this issue, here's a simplified version of the workaround I used: from unicodedata import normalize def normalize_keys(data): return { normalize('NFKC', key): value for key, valu

[issue23091] unpacked keyword arguments are not unicode normalized

2014-12-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: Yeah, kwarg dicts do not have the same checks applied to them as syntactic keyword args. It would be weird if, for example, dict(**mydict) normalized the keys of mydict. -- nosy: +benjamin.peterson resolution: -> not a bug status: open -> closed _

[issue23091] unpacked keyword arguments are not unicode normalized

2014-12-19 Thread R. David Murray
R. David Murray added the comment: I suspect that the normalization is happening in the parsing phase. That is, the keyword argument gets normalized when the python source is compiled, but the dictionary key is, of course, *not* normalized, since it is a literal string. If I'm right, I think

[issue23091] unpacked keyword arguments are not unicode normalized

2014-12-19 Thread S. Andrew Sheppard
S. Andrew Sheppard added the comment: Here's a simple namedtuple example for good measure. from collections import namedtuple Test = namedtuple("Test", [chr(181)]) >>> Test(**{chr(956): "test1"}) Test(ยต='test1') >>> Test(**{chr(181): "test1"}) Traceback (most recent call last): File "", line

[issue23091] unpacked keyword arguments are not unicode normalized

2014-12-19 Thread S. Andrew Sheppard
New submission from S. Andrew Sheppard: I came across unexpected behavior working with unpacking keyword arguments in Python 3. It appears to be related to the automatic normalization of unicode characters to NFKC (PEP 3131), which converts e.g. MICRO SIGN to GREEK SMALL LETTER MU. This conv