bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933)

This commit is contained in:
Anonymous Maarten 2021-01-31 18:55:15 +01:00 committed by GitHub
parent 9073180db5
commit 3243e8a4b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,2 @@
Don't decrement the reference count of the previous user_ptr when
set_panel_userptr fails.

View file

@ -456,7 +456,9 @@ _curses_panel_panel_set_userptr_impl(PyCursesPanelObject *self,
/* In case of an ncurses error, decref the new object again */
Py_DECREF(obj);
}
Py_XDECREF(oldobj);
else {
Py_XDECREF(oldobj);
}
_curses_panel_state *state = PyType_GetModuleState(cls);
return PyCursesCheckERR(state, rc, "set_panel_userptr");