https://github.com/python/cpython/commit/7c0e6378c185313c7377e7e62658f85d0907c94f
commit: 7c0e6378c185313c7377e7e62658f85d0907c94f
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2025-08-14T11:51:33+03:00
summary:

[3.14] GH-137573: mark _PyOptimizer_Optimize as no inline (GH-137731) (#137751)

Co-authored-by: Sachin Shah <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>

files:
A Misc/NEWS.d/next/C_API/2025-08-13-13-41-04.gh-issue-137573.r6uwRf.rst
M Python/optimizer.c

diff --git 
a/Misc/NEWS.d/next/C_API/2025-08-13-13-41-04.gh-issue-137573.r6uwRf.rst 
b/Misc/NEWS.d/next/C_API/2025-08-13-13-41-04.gh-issue-137573.r6uwRf.rst
new file mode 100644
index 00000000000000..dcf0e643dc1ed3
--- /dev/null
+++ b/Misc/NEWS.d/next/C_API/2025-08-13-13-41-04.gh-issue-137573.r6uwRf.rst
@@ -0,0 +1,2 @@
+Mark ``_PyOptimizer_Optimize`` as :c:macro:`Py_NO_INLINE` to
+prevent stack overflow crashes on macOS.
diff --git a/Python/optimizer.c b/Python/optimizer.c
index dde3dd8ebe745a..e2b6adfab595f2 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -109,7 +109,8 @@ uop_optimize(_PyInterpreterFrame *frame, _Py_CODEUNIT 
*instr,
 /* Returns 1 if optimized, 0 if not optimized, and -1 for an error.
  * If optimized, *executor_ptr contains a new reference to the executor
  */
-int
+// gh-137573: inlining this function causes stack overflows
+Py_NO_INLINE int
 _PyOptimizer_Optimize(
     _PyInterpreterFrame *frame, _Py_CODEUNIT *start,
     _PyExecutorObject **executor_ptr, int chain_depth)

_______________________________________________
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