[New-bugs-announce] [issue23091] unpacked keyword arguments are not unicode normalized

S. Andrew Sheppard report at bugs.python.org
Sat Dec 20 03:37:18 CET 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue23091>
_______________________________________


More information about the New-bugs-announce mailing list