← Back to Pull requests

gh-5073: PEP 831: Clarify build backend flag propagation #5074

Open
pablogsal opened this pull request with 158 lines diff across 1 files
View on GitHub
pablogsal pablogsal commented on Aug 04, 2026 09:52 UTC
Author

No description provided by author.

Diff: 158 lines (+99 / -59) across 1 files Reviewer: hugovk Review duration: 126075m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.40) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 158 lines diff across 1 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 2 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
88%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.303
Empty Description empty_description
0.060
Real PR Conversation Timeline
4 items
read-the-docs-community[bot] read-the-docs-community[bot] commented on Aug 04, 2026 09:55 UTC
Bot

<!-- readthedocs-706438 -->

Documentation build overview

📚 pep-previews | 🛠️ Build #33905008 | 📁 Comparing f729d3408beebc6699e14a47cb781d40c52f0d6f against latest (69a447a3f584795a3e0b026d6dc9b3b8ce14bef6)

<kbd> &nbsp; 🔍 Preview build &nbsp; </kbd>

<details open>
<summary>2 files changed</summary>
<br>
<code>±</code> <a href="https://pep-previews--5074.org.readthedocs.build/pep-0764/index.html"><code>pep-0764/index.html</code></a><br>
<code>±</code> <a href="https://pep-previews--5074.org.readthedocs.build/pep-0831/index.html"><code>pep-0831/index.html</code></a><br>
</details>

hugovk hugovk commented on code on Aug 04, 2026 10:01 UTC
Code Review
peps/pep-0831.rst:1
@@ -524,35 +533,59 @@ level and wish to avoid double-specification, analogous to Fedora's per-package
 ``%undefine _include_frame_pointers`` macro.
 
 Extension authors who wish to override the default for a specific module can
-pass ``-fomit-frame-pointer`` in their ``extra_compile_args`` or via
-environment variables; the last flag on the command line wins under GCC and
-Clang.
+pass ``-fomit-frame-pointer`` through their backend's compiler options (for
+example, Setuptools' ``extra_compile_args``) or via environment variables; the
+last flag on the command line wins under GCC and Clang.
 
 Ecosystem Impact
 ----------------
 
-Because the flags are in ``CFLAGS``, they propagate automatically to consumers
-that build against CPython's reported compiler flags, such as C extensions
-built via ``pip``, Setuptools, or direct ``sysconfig`` queries.  Those
-consumers need take no additional action to benefit from this change.
-
-Not all compiled code in the Python ecosystem inherits CPython's ``CFLAGS``.
-Rust extensions built with ``pyo3`` or ``maturin``, C++ libraries with their
-own build systems, and embedding applications that compile CPython from source
-each manage their own compiler flags. This PEP recommends that all such
-projects also enable ``-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer``
-in their builds.  A frame-pointer chain is only as strong as its weakest
-link: a single library in the call stack without frame pointers breaks the
-chain for the entire process, regardless of whether CPython and every other
-library has them.  The goal is that every native component in a Python process
-participates in the frame-pointer chain, so that ``perf record`` and eBPF
-profilers produce complete, useful flame graphs out of the box.
+The ``CFLAGS`` change automatically affects only consumers of CPython's
+reported compiler flags.  Setuptools does this for C extension builds, as do
+backends that emulate its behaviour or query ``sysconfig`` directly.  ``pip``
+is a build frontend and does not itself determine which compiler flags a build
+backend uses.  Other backends may intentionally manage their toolchain without
+using CPython's ``CFLAGS`` and therefore do not inherit this setting.
+
+Rust extensions built with ``pyo3`` or ``maturin``, C and C++ extensions using
+independent build systems, and embedding applications each manage their own
+compiler flags. This PEP recommends that all such projects also enable
+``-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer`` in their builds.  A
+frame-pointer chain is only as strong as its weakest link: a single library in
+the call stack without frame pointers breaks the chain for the entire process,
+regardless of whether CPython and every other library has them.  The goal is
+that every native component in a Python process participates in the
+frame-pointer chain, so that ``perf record`` and eBPF profilers produce
+complete, useful flame graphs out of the box.
 
 Extension authors who observe an unacceptable regression in a specific module
-can opt out per-extension via ``extra_compile_args`` (see `Extension Build
+can opt out through backend-specific compiler options (see `Extension Build
 Impact`_).  Distributions that already enable frame pointers system-wide
 (Fedora, Ubuntu, Arch Linux) need take no action.
 
+Build Backend Guidance
+----------------------

In addition to guidance to build backends, should there be guidance for tools such as cibuildwheel which specify config to build backends?

For example, should they add an option to enable frame pointers in backends, and perhaps make it the default at some point?

savannahostrowski savannahostrowski commented on Aug 05, 2026 03:22 UTC
Reviewer

The clarification here looks right to me. I left a comment on python/cpython#155172; depending on the intended scope there, we may want to reflect its relationship to the future standardized field here.

We'll probably also want to update corresponding CPython docs, since Doc/using/configure.rst still says that the flags "propagate to third-party C extensions through sysconfig".

Reviewers
Assignees
pablogsal pablogsal
Labels
risk: low confidence: 88.6% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 40.3% (MEDIUM) · Higher = larger blast radius
40.3%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 88.6% · Lower = rushed or shallow review
88.6%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 4.6% · Safe to merge
4.6%
Repository