mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Update data model docs to include missing attributes for code objects (GH-13696)
Include and document co_posonlyargcount and co_kwonlyargcount
This commit is contained in:
parent
3a46d5c293
commit
ed222a74a0
1 changed files with 17 additions and 12 deletions
|
|
@ -890,6 +890,8 @@ Internal types
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
single: co_argcount (code object attribute)
|
single: co_argcount (code object attribute)
|
||||||
|
single: co_posonlyargcount (code object attribute)
|
||||||
|
single: co_kwonlyargcount (code object attribute)
|
||||||
single: co_code (code object attribute)
|
single: co_code (code object attribute)
|
||||||
single: co_consts (code object attribute)
|
single: co_consts (code object attribute)
|
||||||
single: co_filename (code object attribute)
|
single: co_filename (code object attribute)
|
||||||
|
|
@ -906,18 +908,21 @@ Internal types
|
||||||
|
|
||||||
Special read-only attributes: :attr:`co_name` gives the function name;
|
Special read-only attributes: :attr:`co_name` gives the function name;
|
||||||
:attr:`co_argcount` is the number of positional arguments (including arguments
|
:attr:`co_argcount` is the number of positional arguments (including arguments
|
||||||
with default values); :attr:`co_nlocals` is the number of local variables used
|
with default values); :attr:`co_posonlyargcount` is the number of
|
||||||
by the function (including arguments); :attr:`co_varnames` is a tuple containing
|
positional-only arguments (including arguments with default values);
|
||||||
the names of the local variables (starting with the argument names);
|
:attr:`co_kwonlyargcount` is the number of keyword-only arguments (including
|
||||||
:attr:`co_cellvars` is a tuple containing the names of local variables that are
|
arguments with default values); :attr:`co_nlocals` is the number of local
|
||||||
referenced by nested functions; :attr:`co_freevars` is a tuple containing the
|
variables used by the function (including arguments); :attr:`co_varnames` is a
|
||||||
names of free variables; :attr:`co_code` is a string representing the sequence
|
tuple containing the names of the local variables (starting with the argument
|
||||||
of bytecode instructions; :attr:`co_consts` is a tuple containing the literals
|
names); :attr:`co_cellvars` is a tuple containing the names of local variables
|
||||||
used by the bytecode; :attr:`co_names` is a tuple containing the names used by
|
that are referenced by nested functions; :attr:`co_freevars` is a tuple
|
||||||
the bytecode; :attr:`co_filename` is the filename from which the code was
|
containing the names of free variables; :attr:`co_code` is a string representing
|
||||||
compiled; :attr:`co_firstlineno` is the first line number of the function;
|
the sequence of bytecode instructions; :attr:`co_consts` is a tuple containing
|
||||||
:attr:`co_lnotab` is a string encoding the mapping from bytecode offsets to
|
the literals used by the bytecode; :attr:`co_names` is a tuple containing the
|
||||||
line numbers (for details see the source code of the interpreter);
|
names used by the bytecode; :attr:`co_filename` is the filename from which the
|
||||||
|
code was compiled; :attr:`co_firstlineno` is the first line number of the
|
||||||
|
function; :attr:`co_lnotab` is a string encoding the mapping from bytecode
|
||||||
|
offsets to line numbers (for details see the source code of the interpreter);
|
||||||
:attr:`co_stacksize` is the required stack size (including local variables);
|
:attr:`co_stacksize` is the required stack size (including local variables);
|
||||||
:attr:`co_flags` is an integer encoding a number of flags for the interpreter.
|
:attr:`co_flags` is an integer encoding a number of flags for the interpreter.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue