On this page
dis.stack_effect
Prev: dis.show_code | Up: dis
Rel: dis.Bytecode, dis.code_info, dis.dis, dis.disassemble
Ref: docs.python.org — dis.stack_effect
Tags: #public #python3 #stdlib #dis
Import
import dis
from dis import stack_effect
Signature & Overview
dis.stack_effect(opcode, oparg=None, /, *, jump=None)
Compute the stack effect of the opcode.
Usage
import dis
assert dis.stack_effect(dis.opmap["POP_TOP"]) == -1
assert dis.stack_effect(dis.opmap["LOAD_CONST"], 0) == 1
Gotchas
- Re-export of
opcode.stack_effect(): Must passopargfor opcodes that take an argument.
REPL Inspect
from dis import stack_effect
help(stack_effect)
Linked from
Related notes
- tuts/python3/stdlib_module/dis/show_code Linked here; links to this page; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/Bytecode Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/code_info Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/dis Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/disassemble Linked here; shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/dis/disco shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/distb shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/findlabels shared tags: #dis, #stdlib
- tuts/python3/stdlib_module/dis/findlinestarts shared tags: #dis, #stdlib