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 conversion is applied to regular keyword arguments but not 
when unpacking arguments via **.

This issue arose while I was working with some automatically generated 
namedtuple classes, but I was able to reproduce it with a simple function:

def test(μ):
    print(μ)

>>> test(µ="test1") # chr(181)
test1

>>> test(μ="test2") # chr(956)
test2

>>> test(**{'μ': "test3"}) # chr(956)
test3

>>> test(**{'µ': "test4"}) # chr(181)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: test() got an unexpected keyword argument 'µ'


I can obviously work around this, but wanted to bring it up in case it's a bug. 
 My naive expectation would be that unpacked ** keys should be treated exactly 
like normal keyword arguments.

----------
components: Unicode
messages: 232956
nosy: ezio.melotti, haypo, sheppard
priority: normal
severity: normal
status: open
title: unpacked keyword arguments are not unicode normalized
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23091>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to