54. `dis`
dis.dis output, Instruction namedtuples, the bytecode iterator API, and reading adaptive specializations.
10 notes
dis.dis output, Instruction namedtuples, the bytecode iterator API, and reading adaptive specializations.
Peephole optimizer passes: constant folding, dead code elimination, and superinstruction formation in Python/flowgraph.c.
Instruction emission, jump fixup, and the assembler in Python/compile.c that produces the final bytecode array.
How compile-time constants are folded, names interned, and local variable slots assigned in the code object.
PyCodeObject fields: co_code, co_consts, co_names, co_varnames, co_filename, and how they are used at runtime.
Multi-pass lowering from AST to CFG to linear bytecode, and the role of each compiler pass in Python/compile.c.
Scope analysis in Python/symtable.c: local, global, free, and cell variable classification before compilation.
AST node types defined in Parser/Python.asdl, the ast module, and how AST nodes map to source locations.
CPython's PEG parser, Grammar/python.gram, the generated Parser/parser.c, and parse tree construction.
Tokenize module internals, the C tokenizer in Parser/tokenize.c, and how indentation becomes INDENT/DEDENT tokens.