https://github.com/python/cpython/commit/043ddefd2bc7585c967c081b179ecbf9ada4d65f
commit: 043ddefd2bc7585c967c081b179ecbf9ada4d65f
branch: main
author: Iason Krommydas <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2026-11-11T21:55:16Z
summary:

gh-161827: Mark `_PyEval_EvalFrameDefault` as `Py_NO_INLINE` (GH-161829)

gh-161827: Mark _PyEval_EvalFrameDefault as Py_NO_INLINE

Signed-off-by: Iason Krommydas <[email protected]>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2026-11-11-21-52-02.gh-issue-161827.3PD3RK.rst
M Python/ceval.c

diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2026-11-11-21-52-02.gh-issue-161827.3PD3RK.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2026-11-11-21-52-02.gh-issue-161827.3PD3RK.rst
new file mode 100644
index 00000000000000..2ae6517db14f15
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2026-11-11-21-52-02.gh-issue-161827.3PD3RK.rst
@@ -0,0 +1,4 @@
+Keep ``_PyEval_EvalFrameDefault`` as a separate frame in the C call stack
+when Python is built with the tail-calling interpreter
+(:option:`--with-tail-call-interp`), so that stack unwinders, profilers and
+other tools that walk the stack can find the interpreter loop.
diff --git a/Python/ceval.c b/Python/ceval.c
index 0d053cdc7a63e3..ccc0edca2fc794 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1200,7 +1200,13 @@ dtrace_function_return(_PyInterpreterFrame *frame)
 }
 #endif
 
-PyObject* _Py_HOT_FUNCTION DONT_SLP_VECTORIZE
+/*
+ * _PyEval_EvalFrameDefault must remain a separate frame in the C call stack:
+ * stack unwinders, profilers and other tools that walk the stack use it to
+ * find the interpreter loop. With the tail-calling interpreter it is small
+ * enough to be inlined into its callers, e.g. by Clang with PGO.
+ */
+Py_NO_INLINE PyObject* _Py_HOT_FUNCTION DONT_SLP_VECTORIZE
 _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, 
int throwflag)
 {
     _Py_EnsureTstateNotNULL(tstate);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to