]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] GH-137573: mark _PyOptimizer_Optimize as no inline (GH-137731) (#137751)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 14 Aug 2025 08:51:33 +0000 (10:51 +0200)
committerGitHub <noreply@github.com>
Thu, 14 Aug 2025 08:51:33 +0000 (11:51 +0300)
Co-authored-by: Sachin Shah <39803835+inventshah@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Misc/NEWS.d/next/C_API/2025-08-13-13-41-04.gh-issue-137573.r6uwRf.rst [new file with mode: 0644]
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 (file)
index 0000000..dcf0e64
--- /dev/null
@@ -0,0 +1,2 @@
+Mark ``_PyOptimizer_Optimize`` as :c:macro:`Py_NO_INLINE` to
+prevent stack overflow crashes on macOS.
index dde3dd8ebe745a840fb66cda7a2fd4170c11bc03..e2b6adfab595f20b78b33f1687d2f83c1eb6b7c2 100644 (file)
@@ -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)