[docs] [issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW
Manuel Vazquez Acosta
report at bugs.python.org
Tue Apr 3 15:42:23 EDT 2018
New submission from Manuel Vazquez Acosta <manuel at merchise.org>:
The documentation of the dis module says that:
CALL_FUNCTION_VAR (argc)
Calls a function. *argc* is interpreted as in CALL_FUNCTION. The
top elements on the stack are the keyword arguments, followed by the
variable argument list, and then the positional arguments.
However, inspecting the how ``f(b=1, *args)`` is actually compiled shows a different order:
>>> import dis
>>> dis.dis(compile('f(b=1, *args)', '<>', 'eval'))
1 0 LOAD_NAME 0 (f)
3 LOAD_NAME 1 (args)
6 LOAD_CONST 0 ('b')
9 LOAD_CONST 1 (1)
12 CALL_FUNCTION_VAR 256 (0 positional, 1 keyword pair)
15 RETURN_VALUE
Notice that the top of the stack contains the explicit keyword arguments.
The documentation of CALL_FUNCTION_VAR_KW is also incorrect.
----------
assignee: -> docs at python
components: +Documentation
nosy: +docs at python
title: CALL_FUNCTION_VAR -> Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW
versions: +Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33216>
_______________________________________
More information about the docs
mailing list