On this page
opcode.stack_effect
Up: opcode
Rel: opcode
Ref: docs.python.org — opcode.stack_effect
Tags: #public #python3 #stdlib #opcode
Import
import opcode
from opcode import stack_effect
Signature & Overview
opcode.stack_effect(opcode, oparg=None, /, *, jump=None)
Compute the stack effect of the opcode.
Usage
import opcode
assert opcode.stack_effect(opcode.opmap["POP_TOP"]) == -1
assert opcode.stack_effect(opcode.opmap["LOAD_CONST"], 0) == 1
Gotchas
- CPython version-specific: Must pass
opargfor opcodes>= HAVE_ARGUMENT.
REPL Inspect
from opcode import stack_effect
help(stack_effect)
Linked from
Related notes
- tuts/python3/stdlib_module/opcode Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib
- tuts/c/stdlib/ctype/isspace shared tags: #stdlib
- tuts/c/stdlib/ctype/tolower shared tags: #stdlib