From 1fbc118c5d3916e920a57cda3cb6d9a0292de26e Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Thu, 5 Sep 2024 10:56:07 -0700 Subject: [PATCH] GH-123545: Remove duplicate Py_DECREF when handling _PyOptimizer_Optimize errors (GH-123546) --- .../2024-09-01-00-02-05.gh-issue-123545.8nQNbL.rst | 1 + Python/bytecodes.c | 4 ---- Python/executor_cases.c.h | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2024-09-01-00-02-05.gh-issue-123545.8nQNbL.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-09-01-00-02-05.gh-issue-123545.8nQNbL.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-09-01-00-02-05.gh-issue-123545.8nQNbL.rst new file mode 100644 index 00000000000..4da4151416d --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-09-01-00-02-05.gh-issue-123545.8nQNbL.rst @@ -0,0 +1 @@ +Fix a double decref in rare cases on experimental JIT builds. diff --git a/Python/bytecodes.c b/Python/bytecodes.c index c4cc8127baf..b5a642dccd2 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -4739,8 +4739,6 @@ dummy_func( if (optimized <= 0) { exit->temperature = restart_backoff_counter(temperature); if (optimized < 0) { - Py_DECREF(current_executor); - tstate->previous_executor = Py_None; GOTO_UNWIND(); } tstate->previous_executor = (PyObject *)current_executor; @@ -4822,8 +4820,6 @@ dummy_func( if (optimized <= 0) { exit->temperature = restart_backoff_counter(exit->temperature); if (optimized < 0) { - Py_DECREF(current_executor); - tstate->previous_executor = Py_None; GOTO_UNWIND(); } GOTO_TIER_ONE(target); diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index d4be7904a50..6d687bbb48b 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -5305,8 +5305,6 @@ if (optimized <= 0) { exit->temperature = restart_backoff_counter(temperature); if (optimized < 0) { - Py_DECREF(current_executor); - tstate->previous_executor = Py_None; GOTO_UNWIND(); } tstate->previous_executor = (PyObject *)current_executor; @@ -5437,8 +5435,6 @@ if (optimized <= 0) { exit->temperature = restart_backoff_counter(exit->temperature); if (optimized < 0) { - Py_DECREF(current_executor); - tstate->previous_executor = Py_None; GOTO_UNWIND(); } GOTO_TIER_ONE(target);