summaryrefslogtreecommitdiffstats
path: root/Modules/_curses_panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_curses_panel.c')
-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 53849e3..d22e2ad 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -433,7 +433,9 @@ _curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyObject *obj)
/* In case of an ncurses error, decref the new object again */
Py_DECREF(obj);
}
- Py_XDECREF(oldobj);
+ else {
+ Py_XDECREF(oldobj);
+ }
return PyCursesCheckERR(rc, "set_panel_userptr");
}