Skip to content
Preprint

CPyGraph: A Version-Aware Static Analysis Framework for Native CPython Bytecode

Sep 2026 · 1 citation · 35 references
Computer Science

TL;DR

CPyGraph, a C++ framework for package-level analysis of native CPython bytecode, is presented, a C++ framework for package-level analysis of native CPython bytecode that matches PyCG on its 112-program call-graph benchmark.

Abstract

Static analysis of Python packages must recover both program structure and object flow across first-class functions, dynamic dispatch, implicit protocol calls, exceptions, closures, and module execution. Native CPython bytecode provides the executable lowering of these behaviors, but its instruction, call, stack, and exception representations change across releases. This creates a need for a version-aware analysis foundation whose graph products share the same bytecode identities and semantics. We present CPyGraph, a C++ framework for package-level analysis of native CPython bytecode. Version- specific adapters expose stack, control, call, lexical, protocol, and exception semantics through a shared interface while preserving code-object identities and native bytecode offsets. An operand-stack-aware Andersen points- to analysis and call graph grow together to a fixed point. Their shared state supports exception-aware CFGs, block-level CDGs, and interprocedural DDGs, with optional function-level flow, context, and bounded path sensitivity. The framework also records unresolved dynamic behavior through typed coverage summaries. We evaluate CPyGraph with PYGBench, 201 package-level programs and 1,733 fixed candidates. On CPython 3.10, the default analysis reaches 91.40% candidate precision and 100% recall; complete sensitivity reaches 94.97% precision with the same recall. Across CPython 3.10-3.14, 1,328 of 1,334 version-invariant queries agree, and CPyGraph matches PyCG on its 112-program call-graph benchmark.

View source

Similar papers

Book Open access Sep 2026

TasmScan: Continuation-Aware Taint Analysis for TVM Bytecode with Savelist Abstraction

TasmScan is presented, the first bytecode-level static analysis framework for TVM that enables cross-continuation data flow reasoning without requiring source code and ablation confirms that savelist propagation is essential for resolving indirect register calls that depend on cross-continuation register passing.

Yi-Xuan Liu, Yin Wu, Yi Li · 0 citations
Book Open access Oct 2026

Beyond Java 6: Reviving Reflection-Aware Static Analysis for Modern JVMs

Static program analysis for Java is significantly hindered by the use of reflection and custom class loaders. To address this, the popular TamiFlex framework traces concrete targets of reflective calls and dumps loaded classes via a Play-out agent, enabling static analysis followed by re-insertion of transformed classe...

Gauravsingh Sisodia, Poorna Teja Pasala, Aditya Anand et al. · 0 citations
Open access 2026

Rethinking Exception Handling in a Lightweight JavaScript Interpreter

Dynamic language interpreters must handle exceptions as part of normal execution, since many semantic checks are performed at runtime. In interpreter-based JavaScript engines, particularly in lightweight or resource-constrained environments, exception propagation is often implemented using return-based mechanisms, wher...

Zoltán Herczeg, Seong-Moo Kim, Hyukwoo Park · 0 citations
Book Open access Oct 2026

SAF: An AI-Agent-Ready and Browser-Accessible Static Analysis Framework for LLVM IR

Static program analysis finds bugs before software ships, and modern checkers for C/C++ depend on whole-program infrastructure: pointer analysis, value-flow tracking, taint analysis, and IFDS-based data flow on top of LLVM. Today’s LLVM-IR frameworks fall short. SVF, Phasar, and Lotus expose their analyses through C++...

Yue-Kang Li, Wei Li, Wei Song et al. · 0 citations
Open access Aug 2026

HMCFA: A Precise and Practical Big-Step Control Flow Analysis for Effect Handlers

HMCFA presents HMCFA, the first practical control flow analysis for effect handlers based on big-step semantics, and proves the concrete semantics equivalent to Bauer and Pretnar’s and establishes soundness of the abstraction via address freshness.

Tim A. Whiting, Kimball Germane · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.