New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:

The argument to CALL_FUNCTION is overloaded to show both the number of 
positional arguments and keyword arguments (shifted by 8-bits):

>>> dis("foo(10, opt=True)")
  1           0 LOAD_NAME                0 (foo) 
              3 LOAD_CONST               0 (10) 
              6 LOAD_CONST               1 ('opt') 
              9 LOAD_CONST               2 (True) 
             12 CALL_FUNCTION          257 
             15 RETURN_VALUE         

It is not obvious that the 257 argument causes three stack arguments to be 
popped.

The disassembly should add a parenthetical to explain the composition:

>>> dis("foo(10, opt=True)")
  1           0 LOAD_NAME                0 (foo) 
              3 LOAD_CONST               0 (10) 
              6 LOAD_CONST               1 ('opt') 
              9 LOAD_CONST               2 (True) 
             12 CALL_FUNCTION          257 (1 positional, 1 keyword pair)
             15 RETURN_VALUE

----------
components: Library (Lib)
messages: 133481
nosy: rhettinger
priority: normal
severity: normal
status: open
title: disassembly needs to argument counts on calls with keyword args
type: feature request
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11823>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to