[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Manuel Vazquez Acosta

Manuel Vazquez Acosta <man...@merchise.org> added the comment:

Correction, the documentation for CALL_FUNCTION_VAR said:

Calls a function. *argc* is interpreted as in :opcode:`CALL_FUNCTION`. The top 
element on the stack contains the variable argument list, followed by keyword 
and positional arguments.


In a previous comment I pasted the version I'm putting in the PR.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33216>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Manuel Vazquez Acosta

Change by Manuel Vazquez Acosta <man...@merchise.org>:


--
keywords: +patch
pull_requests: +6075
stage:  -> patch review

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33216>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33216] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW

2018-04-03 Thread Manuel Vazquez Acosta

New submission from Manuel Vazquez Acosta <man...@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_NAME0 (f)
  3 LOAD_NAME1 (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@python
components: +Documentation
nosy: +docs@python
title: CALL_FUNCTION_VAR -> Wrong order of stack for CALL_FUNCTION_VAR and 
CALL_FUNCTION_VAR_KW
versions: +Python 3.5

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33216>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33216] CALL_FUNCTION_VAR

2018-04-03 Thread Manuel Vazquez Acosta

Change by Manuel Vazquez Acosta <man...@merchise.org>:


--
nosy: mvaled
priority: normal
severity: normal
status: open
title: CALL_FUNCTION_VAR

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33216>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com