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>
--- /dev/null
+Mark ``_PyOptimizer_Optimize`` as :c:macro:`Py_NO_INLINE` to
+prevent stack overflow crashes on macOS.
/* 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)