8000 [3.9] bpo-41604: Don't decrement the reference count of the previous … · serhiy-storchaka/cpython@e178858 · GitHub
[go: up one dir, main page]

Skip to content

Commit e178858

Browse files
madebrserhiy-storchaka
authored andcommitted
[3.9] bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (pythonGH-21933).
(cherry picked from commit 3243e8a) Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
1 parent e9d4960 commit e178858

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)
0