[New-bugs-announce] [issue35634] kwargs regression when there are multiple entries with the same key
iceboy
report at bugs.python.org
Tue Jan 1 20:04:33 EST 2019
New submission from iceboy <spam at iceboy.org>:
Using the multidict package on pypi to illustrate the problem.
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multidict
>>> d = multidict.CIMultiDict([('a', 1), ('a', 2)])
>>> def foo(**kwargs): pass
...
>>> foo(**d)
>>> foo(**{}, **d)
Python 3.6.7 (default, Oct 21 2018, 08:08:16)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multidict
>>> d = multidict.CIMultiDict([('a', 1), ('a', 2)])
>>> def foo(**kwargs): pass
...
>>> foo(**d)
>>> foo(**{}, **d)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: foo() got multiple values for keyword argument 'a'
(1) foo(**d)
(2) foo(**{}, **d)
(1) works fine in both versions but (2) only works in Python 3.5 but raises TypeError in Python 3.6. This should be a regression. We should either make both expressions work or raises error.
----------
messages: 332849
nosy: iceboy
priority: normal
severity: normal
status: open
title: kwargs regression when there are multiple entries with the same key
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35634>
_______________________________________
More information about the New-bugs-announce
mailing list