opcode
| Use Case | Command | Description |
|---|---|---|
| Look up opcode number | opcode.opmap['LOAD_CONST'] | Get integer opcode from name |
| Get opcode name | opcode.opname[100] | Retrieve human-readable name from number |
| Check argument threshold | opcode.HAVE_ARGUMENT | Minimum opcode value that requires an argument |
| Compute stack effect | opcode.stack_effect(opcode, oparg) | Calculate net stack change of an instruction |
| List all opcodes | opcode.opmap | Dictionary mapping bytecode names to numbers |
| List opcode names | opcode.opname | Indexed list of bytecode names |
| Check if opcode is a jump | opcode.hasjrel / opcode.hasjabs | Lists of opcodes with relative/absolute jumps |
https://docs.python.org/3.10/library/opcode.html
The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.
opcode module - potentially shared between dis and other modules which operate on bytecodes (e.g. peephole optimizers).
stack_effect(opcode, oparg=None, /, *, jump=None)
Compute the stack effect of the opcode.
EXTENDED_ARG = 144HAVE_ARGUMENT = 90__all__ = ['cmp_op', 'hasconst', 'hasname', 'hasjrel', 'hasjabs', 'has...']cmp_op = ('<', '<=', '==', '!=', '>', '>=')hascompare = [107]hasconst = [100]hasfree = [135, 136, 137, 138, 148]hasjabs = [111, 112, 113, 114, 115, 121]hasjrel = [93, 110, 122, 143, 154]haslocal = [124, 125, 126]hasname = [90, 91, 95, 96, 97, 98, 101, 106, 108, 109, 116, 160]hasnargs = []opmap = {'BEFORE_ASYNC_WITH': 52, 'BINARY_ADD': 23, 'BINARY_AND': 64, ...}opname = ['<0>', 'POP_TOP', 'ROT_TWO', 'ROT_THREE', 'DUP_TOP', 'DUP_TO...']/usr/lib/python3.10/opcode.py
Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 15:05 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format