8000 bpo-41604: Don't decrement the reference count of the previous user_p… · python/cpython@39a4378 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39a4378

Browse files
committed
bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails
1 parent 12695f4 commit 39a4378

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,9 @@ _curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyObject *obj)
439439
if (rc == ERR) {
440440
/* In case of an ncurses error, decref the new object again */
441441
Py_DECREF(obj);
442+
} else {
443+
Py_XDECREF(oldobj);
442444
}
443-
Py_XDECREF(oldobj);
444445
return PyCursesCheckERR(rc, "set_panel_userptr");
445446
}
446447

0 commit comments

Comments
 (0)
0