diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-09-05-11-31-27.gh-issue-104584.IRSXA2.rst b/Misc/NEWS.d/next/Core and Builtins/2023-09-05-11-31-27.gh-issue-104584.IRSXA2.rst new file mode 100644 index 00000000000..7f556bf8c31 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-09-05-11-31-27.gh-issue-104584.IRSXA2.rst @@ -0,0 +1,2 @@ +Fix a crash when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` +enabled and an error occurs during optimization. diff --git a/Python/optimizer.c b/Python/optimizer.c index 8aaf9f9fd7c..c6d0f9e5bf2 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -169,6 +169,7 @@ _PyOptimizer_BackEdge(_PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNI if (err <= 0) { assert(executor == NULL); if (err < 0) { + _PyFrame_SetStackPointer(frame, stack_pointer); return NULL; } goto jump_to_destination;