]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41604: Don't decrement the reference count of the previous user_ptr when set_pane...
authorAnonymous Maarten <madebr@users.noreply.github.com>
Sun, 31 Jan 2021 17:55:15 +0000 (18:55 +0100)
committerGitHub <noreply@github.com>
Sun, 31 Jan 2021 17:55:15 +0000 (19:55 +0200)
Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst [new file with mode: 0644]
Modules/_curses_panel.c

diff --git a/Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst b/Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst
new file mode 100644 (file)
index 0000000..0f9794c
--- /dev/null
@@ -0,0 +1,2 @@
+Don't decrement the reference count of the previous user_ptr when
+set_panel_userptr fails.
index d782ccd08679862f05da16e67a04c82e01fe7bee..94caf8c93bc8c317632f024a43b0215debcd4862 100644 (file)
@@ -456,7 +456,9 @@ _curses_panel_panel_set_userptr_impl(PyCursesPanelObject *self,
         /* In case of an ncurses error, decref the new object again */
         Py_DECREF(obj);
     }
-    Py_XDECREF(oldobj);
+    else {
+        Py_XDECREF(oldobj);
+    }
 
     _curses_panel_state *state = PyType_GetModuleState(cls);
     return PyCursesCheckERR(state, rc, "set_panel_userptr");