[issue2292] Missing *-unpacking generalizations

Neil Girdhar report at bugs.python.org
Fri Jan 23 06:26:36 CET 2015


Neil Girdhar added the comment:

Ah, sorry, yes, this is what I meant (and I see what your'e trying to fix now!):

>>> import dis
>>> def f(x,y): pass
...
>>> dis.dis("f(y=1, **{'x': 1}, x=2)")
  1           0 LOAD_NAME                0 (f)
              3 LOAD_CONST               0 ('y')
              6 LOAD_CONST               1 (1)
              9 LOAD_CONST               1 (1)
             12 LOAD_CONST               2 ('x')
             15 BUILD_MAP                1
             18 LOAD_CONST               3 (2)
             21 LOAD_CONST               2 ('x')
             24 BUILD_MAP                1
             27 BUILD_MAP_UNPACK         2
             30 CALL_FUNCTION_KW       256 (0 positional, 1 keyword pair)
             33 RETURN_VALUE
>>> f(y=1, **{'x': 1}, x=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: <module>() got multiple values for keyword argument 'x'
>>>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2292>
_______________________________________


More information about the Python-bugs-list mailing list