Author mvaled
Recipients docs@python, mvaled
Date 2018-04-03.19:42:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The documentation of the dis module says that:


   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.
Date User Action Args
2018-04-03 19:42:23mvaledsetrecipients: + mvaled, docs@python
2018-04-03 19:42:23mvaledsetmessageid: <>
2018-04-03 19:42:23mvaledlinkissue33216 messages
2018-04-03 19:42:23mvaledcreate