]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-104584: Restore frame->stacktop on optimizer error (GH-108953)
authorBrandt Bucher <brandtbucher@microsoft.com>
Wed, 6 Sep 2023 20:59:50 +0000 (13:59 -0700)
committerGitHub <noreply@github.com>
Wed, 6 Sep 2023 20:59:50 +0000 (13:59 -0700)
Misc/NEWS.d/next/Core and Builtins/2023-09-05-11-31-27.gh-issue-104584.IRSXA2.rst [new file with mode: 0644]
Python/optimizer.c

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 (file)
index 0000000..7f556bf
--- /dev/null
@@ -0,0 +1,2 @@
+Fix a crash when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>`
+enabled and an error occurs during optimization.
index 8aaf9f9fd7cb1454216daf64b428af4f6c3767ef..c6d0f9e5bf22d7df640d21e2fc7b22c9bb31cfed 100644 (file)
@@ -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;