Skip to content

Commit 3243e8a

Browse files
authored
bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933)
1 parent 9073180 commit 3243e8a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Don't decrement the reference count of the previous user_ptr when
2+
set_panel_userptr fails.

Modules/_curses_panel.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,9 @@ _curses_panel_panel_set_userptr_impl(PyCursesPanelObject *self,
456456
/* In case of an ncurses error, decref the new object again */
457457
Py_DECREF(obj);
458458
}
459-
Py_XDECREF(oldobj);
459+
else {
460+
Py_XDECREF(oldobj);
461+
}
460462

461463
_curses_panel_state *state = PyType_GetModuleState(cls);
462464
return PyCursesCheckERR(state, rc, "set_panel_userptr");

0 commit comments

Comments
 (0)