[Python-checkins] [3.9] bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933). (GH-24403)
serhiy-storchaka
webhook-mailer at python.org
Sun Jan 31 14:44:35 EST 2021
https://github.com/python/cpython/commit/3c8d6934436e20163be802f5239c5b4e4925eeec
commit: 3c8d6934436e20163be802f5239c5b4e4925eeec
branch: 3.9
author: Serhiy Storchaka <storchaka at gmail.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2021年01月31日T21:44:31+02:00
summary:
[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 3243e8a4b4b4cf321f9b28335d565742a34b1976)
Co-authored-by: Anonymous Maarten <madebr at users.noreply.github.com>
files:
A Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst
M Modules/_curses_panel.c
diff --git a/Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst b/Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst
new file mode 100644
index 0000000000000..0f9794cbdb321
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst
@@ -0,0 +1,2 @@
+Don't decrement the reference count of the previous user_ptr when
+set_panel_userptr fails.
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index f124803493d88..4f026794e3417 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -440,7 +440,9 @@ _curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyObject *obj)
/* In case of an ncurses error, decref the new object again */
Py_DECREF(obj);
}
- Py_XDECREF(oldobj);
+ else {
+ Py_XDECREF(oldobj);
+ }
return PyCursesCheckERR(rc, "set_panel_userptr");
}
More information about the Python-checkins
mailing list