Files
youknowdot 65ee7bae8b Align Python 3.15 bytecode tooling (#9344)
Extract independent bytecode tooling from the Python 3.15 integration. Decode packed import-name arguments without changing older-interpreter fallback behavior, validate canonical opcode numbering, bound deoptimization families to the enum, and reuse parsed CPython analysis.

Validated generators reproduce tracked metadata exactly; normal, lazy and eager import fallback matches canonical disassembly. No interpreter, generated metadata or test changes.

Assisted-by: OpenAI Codex: model version unavailable
2026-10-25 15:11:10 +09:00

30 lines
760 B
Python

import functools
import os
import pathlib
import sys
try:
CPYTHON_ROOT = pathlib.Path(os.environ["CPYTHON_ROOT"]).expanduser().resolve()
except KeyError:
raise ValueError("Missing environment variable 'CPYTHON_ROOT'")
CPYTHON_TOOLS_LIB = CPYTHON_ROOT / "Tools" / "cases_generator"
if (path := CPYTHON_TOOLS_LIB.as_posix()) not in sys.path:
sys.path.append(path)
from analyzer import SKIP_PROPERTIES, Analysis, Family, Properties, analyze_files
from stack import get_stack_effect
@functools.cache
def get_analysis() -> Analysis:
from generators_common import DEFAULT_INPUT
analysis = analyze_files([DEFAULT_INPUT])
# Our speration is done at the enum definition
analysis.instructions |= analysis.pseudos
return analysis