New submission from Arnaud Delobelle <arno...@googlemail.com>:

The description of the opcode MAKE_FUNCTION in the dis module document is out 
of date.  It still describes the 2.X version of the opcode:

"""
MAKE_FUNCTION(argc)
Pushes a new function object on the stack. TOS is the code associated with the 
function. The function object is defined to have argc default parameters, which 
are found below TOS.
"""

According to http://hg.python.org/cpython/file/default/Python/ceval.c#l2684:


 2684             int posdefaults = oparg & 0xff;
 2685             int kwdefaults = (oparg>>8) & 0xff;
 2686             int num_annotations = (oparg >> 16) & 0x7fff;

So the documentation should read something like

"""
MAKE_FUNCTION(argc)
Pushes a new function object on the stack. TOS is the code associated with the 
function. The function object is defined to have argc & 0xFF positional default 
parameters, (argc >> 8) & 0xFF keyword only default parameters, and (argc >> 
16) & 0x7FFF parameter annotations which are push below TOS in this order. For 
each keyword only default, the name of the parameter is pushed just below its 
default value. On top of all the annotations, a tuple is pushed listing the 
parameter names for these annotations.
"""

----------
assignee: docs@python
components: Documentation
messages: 144393
nosy: arno, docs@python, terry.reedy
priority: normal
severity: normal
status: open
title: Dis module - documentation of MAKE_FUNCTION
versions: Python 3.3

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

Reply via email to