This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sheppard
Recipients ezio.melotti, sheppard, vstinner
Date 2014-12-20.02:37:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1419043038.74.0.103514960492.issue23091@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-12-20 02:37:18sheppardsetrecipients: + sheppard, vstinner, ezio.melotti
2014-12-20 02:37:18sheppardsetmessageid: <1419043038.74.0.103514960492.issue23091@psf.upfronthosting.co.za>
2014-12-20 02:37:18sheppardlinkissue23091 messages
2014-12-20 02:37:17sheppardcreate