On this page
  1. opcode.stack_effect
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from opcode import stack_effect
help(stack_effect)

Linked from

Related notes