diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-01-31 20:51:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-31 20:51:23 (GMT) |
commit | 931263baab62b1c3fa7647e45ec6ee6ef4409e7c (patch) | |
tree | 4d51ace53587de210a7c415a87e6fd93549b230a | |
parent | 7ca947e93bff2b9d78312dc8ed8e0a2b7d25d3f3 (diff) | |
download | cpython-931263baab62b1c3fa7647e45ec6ee6ef4409e7c.zip cpython-931263baab62b1c3fa7647e45ec6ee6ef4409e7c.tar.gz cpython-931263baab62b1c3fa7647e45ec6ee6ef4409e7c.tar.bz2 |
[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@users.noreply.github.com>
(cherry picked from commit 3c8d6934436e20163be802f5239c5b4e4925eeec)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
-rw-r--r-- | Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst | 2 | ||||
-rw-r--r-- | Modules/_curses_panel.c | 4 |
2 files changed, 5 insertions, 1 deletions
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 0000000..0f9794c --- /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 53849e3..d22e2ad 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -433,7 +433,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"); } |