Skip to content

Commit 3c8d693

Browse files
[3.9] bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933). (GH-24403)
(cherry picked from commit 3243e8a) Co-authored-by: Anonymous Maarten <[email protected]>
1 parent e9d4960 commit 3c8d693

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
@@ -440,7 +440,9 @@ _curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyObject *obj)
440440
/* In case of an ncurses error, decref the new object again */
441441
Py_DECREF(obj);
442442
}
443-
Py_XDECREF(oldobj);
443+
else {
444+
Py_XDECREF(oldobj);
445+
}
444446
return PyCursesCheckERR(rc, "set_panel_userptr");
445447
}
446448

0 commit comments

Comments
 (0)