https://github.com/python/cpython/commit/89729f2ef7f9473d9e4b898b2ed49a065a67f450
commit: 89729f2ef7f9473d9e4b898b2ed49a065a67f450
branch: main
author: Ken Jin <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2025-12-17T00:12:32Z
summary:

gh-142543: Mark tracer functions as Py_NO_INLINE (GH-142846)

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-23-26-41.gh-issue-142543.wJKjBs.rst
M Python/optimizer.c

diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-23-26-41.gh-issue-142543.wJKjBs.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-23-26-41.gh-issue-142543.wJKjBs.rst
new file mode 100644
index 00000000000000..0897127fec747e
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-23-26-41.gh-issue-142543.wJKjBs.rst
@@ -0,0 +1 @@
+Fix a stack overflow on Clang JIT build configurations with full LTO.
diff --git a/Python/optimizer.c b/Python/optimizer.c
index b215e43128fa2c..18f54f9bc23476 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -582,7 +582,8 @@ is_terminator(const _PyUOpInstruction *uop)
 
 /* Returns 1 on success (added to trace), 0 on trace end.
  */
-int
+// gh-142543: inlining this function causes stack overflows
+Py_NO_INLINE int
 _PyJit_translate_single_bytecode_to_trace(
     PyThreadState *tstate,
     _PyInterpreterFrame *frame,
@@ -994,7 +995,8 @@ _PyJit_translate_single_bytecode_to_trace(
 }
 
 // Returns 0 for do not enter tracing, 1 on enter tracing.
-int
+// gh-142543: inlining this function causes stack overflows
+Py_NO_INLINE int
 _PyJit_TryInitializeTracing(
     PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT 
*curr_instr,
     _Py_CODEUNIT *start_instr, _Py_CODEUNIT *close_loop_instr, int 
curr_stackdepth, int chain_depth,
@@ -1066,7 +1068,7 @@ _PyJit_TryInitializeTracing(
     return 1;
 }
 
-void
+Py_NO_INLINE void
 _PyJit_FinalizeTracing(PyThreadState *tstate)
 {
     _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)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