Skip to content

Commit 1f23f50

Browse files
inventshahhugovkencukou
authored andcommitted
pythonGH-137573: mark _PyOptimizer_Optimize as no inline (pythonGH-137731)
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
1 parent b1e373f commit 1f23f50

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)