Author mvaled
Recipients docs@python, mvaled
Date 2018-04-03.19:42:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522784543.83.0.467229070634.issue33216@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-04-03 19:42:23mvaledsetrecipients: + mvaled, docs@python
2018-04-03 19:42:23mvaledsetmessageid: <1522784543.83.0.467229070634.issue33216@psf.upfronthosting.co.za>
2018-04-03 19:42:23mvaledlinkissue33216 messages
2018-04-03 19:42:23mvaledcreate