diff options
author | Xiang Zhang <angwerzx@126.com> | 2017-04-13 10:38:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 10:38:28 +0800 |
commit | a6902e662c18dc837d40664eaafe50a44aae6366 (patch) | |
tree | f58a5a526462e4db544721e903d7e2bfcef38e10 /Lib/inspect.py | |
parent | 4c0d9ea995da595e90e08813b89510de59907802 (diff) | |
download | cpython-git-a6902e662c18dc837d40664eaafe50a44aae6366.tar.gz |
bpo-26985: Add missing info of code object in inspect documentation (GH-1090)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 4d56ef5d41..a2dcb888a0 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -253,18 +253,24 @@ def iscode(object): """Return true if the object is a code object. Code objects provide these attributes: - co_argcount number of arguments (not including * or ** args) - co_code string of raw compiled bytecode - co_consts tuple of constants used in the bytecode - co_filename name of file in which this code object was created - co_firstlineno number of first line in Python source code - co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg - co_lnotab encoded mapping of line numbers to bytecode indices - co_name name with which this code object was defined - co_names tuple of names of local variables - co_nlocals number of local variables - co_stacksize virtual machine stack space required - co_varnames tuple of names of arguments and local variables""" + co_argcount number of arguments (not including *, ** args + or keyword only arguments) + co_code string of raw compiled bytecode + co_cellvars tuple of names of cell variables + co_consts tuple of constants used in the bytecode + co_filename name of file in which this code object was created + co_firstlineno number of first line in Python source code + co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg + | 16=nested | 32=generator | 64=nofree | 128=coroutine + | 256=iterable_coroutine | 512=async_generator + co_freevars tuple of names of free variables + co_kwonlyargcount number of keyword only arguments (not including ** arg) + co_lnotab encoded mapping of line numbers to bytecode indices + co_name name with which this code object was defined + co_names tuple of names of local variables + co_nlocals number of local variables + co_stacksize virtual machine stack space required + co_varnames tuple of names of arguments and local variables""" return isinstance(object, types.CodeType) def isbuiltin(object): |