aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnonymous Maarten <madebr@users.noreply.github.com>2021-01-31 18:55:15 +0100
committerGitHub <noreply@github.com>2021-01-31 19:55:15 +0200
commit3243e8a4b4b4cf321f9b28335d565742a34b1976 (patch)
tree1e586520243b586e165edf29f9880da19d6bbb86 /Modules
parentbpo-43083: Fix error handling in _sqlite3 (GH-24395) (diff)
downloadcpython-3243e8a4b4b4cf321f9b28335d565742a34b1976.tar.gz
cpython-3243e8a4b4b4cf321f9b28335d565742a34b1976.tar.bz2
cpython-3243e8a4b4b4cf321f9b28335d565742a34b1976.zip
bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_curses_panel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index d782ccd0867..94caf8c93bc 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -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");