[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

[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)

[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