changeset: 101280:1662b41e1663 branch: 2.7 parent: 101278:f06baed1bb0c user: Serhiy Storchaka date: Mon May 09 00:11:59 2016 +0300 files: Misc/NEWS Modules/_curses_panel.c description: Issue #25745: Fixed leaking a userptr in curses panel destructor. diff -r f06baed1bb0c -r 1662b41e1663 Misc/NEWS --- a/Misc/NEWS Mon May 09 00:02:06 2016 +0300 +++ b/Misc/NEWS Mon May 09 00:11:59 2016 +0300 @@ -77,7 +77,7 @@ Library ------- -- Issue #26881: modulefinder now works with bytecode with extended args. +- Issue #25745: Fixed leaking a userptr in curses panel destructor. - Issue #17765: weakref.ref() no longer silently ignores keyword arguments. Patch by Georg Brandl. diff -r f06baed1bb0c -r 1662b41e1663 Modules/_curses_panel.c --- a/Modules/_curses_panel.c Mon May 09 00:02:06 2016 +0300 +++ b/Modules/_curses_panel.c Mon May 09 00:11:59 2016 +0300 @@ -191,6 +191,11 @@ static void PyCursesPanel_Dealloc(PyCursesPanelObject *po) { + PyObject *obj = (PyObject *) panel_userptr(po->pan); + if (obj) { + (void)set_panel_userptr(po->pan, NULL); + Py_DECREF(obj); + } (void)del_panel(po->pan); if (po->wo != NULL) { Py_DECREF(po->wo);