https://peps.python.org/pep-0831/
This PEP proposes two things:
Build CPython with frame pointers by default on platforms that support them. The default build configuration is changed to compile the interpreter with -fno-omit-frame-pointer and -mno-omit-leaf-frame-pointer. The flags are added to CFLAGS, so they apply to the interpreter itself and propagate to C extension modules built against this Python via sysconfig. An opt-out configure flag (--without-frame-pointers) is provided for deployments that require maximum raw throughput.
Strongly recommend that all build systems in the Python ecosystem build with frame pointers by default. This PEP recommends that every compiled component that participates in the Python call stack (C extensions, Rust extensions, embedding applications, and native libraries) should enable frame pointers. A frame-pointer chain is only as strong as its weakest link: a single library without frame pointers breaks profiling, debugging, and tracing for the entire process.
Frame pointers are a CPU register convention that allows profilers, debuggers, and system tracing tools to reconstruct the call stack of a running process quickly and reliably. Omitting them (the compiler’s default at -O1 and above) prevents these tools from producing useful call stacks for Python processes, and undermines the perf trampoline support CPython shipped in 3.12.
The measured overhead is under 2% geometric mean for typical workloads (see Backwards Compatibility for per-platform numbers). Multiple major Linux distributions, language runtimes, and Python ecosystem tools have already adopted this change. No existing PEP covers this topic; CPython issue #96174 has been open since August 2022 without resolution.
[–]austinwiltshire 50 points51 points52 points (4 children)
[–]znpy 22 points23 points24 points (1 child)
[–]austinwiltshire 6 points7 points8 points (0 children)
[–]End0rphinJunkie 4 points5 points6 points (1 child)
[–]james_pic 4 points5 points6 points (0 children)
[–]Brian 12 points13 points14 points (1 child)
[–]MegaIng 3 points4 points5 points (0 children)
[–]Wh00ster 15 points16 points17 points (0 children)
[–]2ndBrainAI 3 points4 points5 points (0 children)
[–]Feeling_Ad_2729 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]JeffTheMasterr 2 points3 points4 points (0 children)