Skip to content

Commit c9d7065

Browse files
inventshahhugovkencukou
authored
GH-137573: mark _PyOptimizer_Optimize as no inline (GH-137731)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 7a703c8 commit c9d7065

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Mark ``_PyOptimizer_Optimize`` as :c:macro:`Py_NO_INLINE` to
2+
prevent stack overflow crashes on macOS.

Python/optimizer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ uop_optimize(_PyInterpreterFrame *frame, _Py_CODEUNIT *instr,
109109
/* Returns 1 if optimized, 0 if not optimized, and -1 for an error.
110110
* If optimized, *executor_ptr contains a new reference to the executor
111111
*/
112-
int
112+
// gh-137573: inlining this function causes stack overflows
113+
Py_NO_INLINE int
113114
_PyOptimizer_Optimize(
114115
_PyInterpreterFrame *frame, _Py_CODEUNIT *start,
115116
_PyExecutorObject **executor_ptr, int chain_depth)

0 commit comments

Comments
 (0)