PEP 831 – Frame Pointers Everywhere: Enabling System-Level Observability for Python

Hi everyone! :wave:

We are happy to announce PEP 831 – “Frame Pointers Everywhere”

This PEP proposes building CPython with -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer by default starting in Python 3.15, so that profilers, debuggers, and eBPF-based tracing tools (perf, py-spy, bpftrace, Pyroscope, etc.) can produce complete, reliable call stacks for Python processes out of the box and we can enjoy more reliable profiling, debugging and system observability.

The future is now!

25 Likes

+10 We should just do it. Many of the largest companies in the world have been building everything (including CPython) they run in their fleets of datacenters for decades with frame pointers enabled for all of the reasons spelled out in the PEP.

10 Likes

I would also like to publicly thank my dear co-authors @savannahostrowski, @kj0 and @diegor! You all rock :sign_of_the_horns:

9 Likes

This is an awesome write up, as a non-expert that’s tangentially interested in profiing, I really appreciate the pedagogical explanations! :sign_of_the_horns:

I would also like to publicly thank my dear co-authors @savannahostrowski, @kj0 and @diegor! You all rock :sign_of_the_horns:

Diego is not included in the PEP author list?

3 Likes

Yes, we are waiting for some (external) procedures to be approved before it gets added.

2 Likes

After extensive deliberation the Steering Council has decided to accept PEP 831 (Frame Pointers Everywhere: yahdah yahdah), because it’s clearly the correct and necessary thing… although we wish the PEP and its title had been a lot shorter, given how much of an obvious decision it is. Congrats!

(Pablo and Savannah, as PEP authors, were not involved in the decision process.)

19 Likes

Hi, I just found out about this PEP. Love the idea. It seems though that no build backend authors looked at this PEP in detail - that would probably have been helpful. What the PEP says about sysconfig and CFLAGS propagation is pretty much entirely setuptools-specific. It would be useful to update it for the generic case[1], and if the goal really is to get all build backends to inherit the CPython interpreter’s build-time choice, then the modern way would be to add it to build-details.json (see PEP 739). I posted a more extensive analysis about how to deal with this PEPs recommendations at Building extensions with hardening flags (via manylinux) - #19 by rgommers.


  1. Many of the most widely used packages have moved away from setuptools by now, so this isn’t just academic. ↩︎

2 Likes