https://github.com/python/cpython/commit/1fbc118c5d3916e920a57cda3cb6d9a0292de26e
commit: 1fbc118c5d3916e920a57cda3cb6d9a0292de26e
branch: main
author: Savannah Ostrowski <[email protected]>
committer: brandtbucher <[email protected]>
date: 2024-09-05T10:56:07-07:00
summary:

GH-123545: Remove duplicate Py_DECREF when handling _PyOptimizer_Optimize 
errors (GH-123546)

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2024-09-01-00-02-05.gh-issue-123545.8nQNbL.rst
M Python/bytecodes.c
M Python/executor_cases.c.h

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 00000000000000..4da4151416d13c
--- /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 c4cc8127bafbb4..b5a642dccd2aec 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 d4be7904a50c10..6d687bbb48b0ba 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);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to