]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-41604: Don't decrement the reference count of the previous user_ptr when...
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 31 Jan 2021 19:44:31 +0000 (21:44 +0200)
committerGitHub <noreply@github.com>
Sun, 31 Jan 2021 19:44:31 +0000 (21:44 +0200)
(cherry picked from commit 3243e8a4b4b4cf321f9b28335d565742a34b1976)

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
Misc/NEWS.d/next/Library/2020-08-21-15-24-14.bpo-41604.rTXleO.rst [new file with mode: 0644]
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 (file)
index 0000000..0f9794c
--- /dev/null
@@ -0,0 +1,2 @@
+Don't decrement the reference count of the previous user_ptr when
+set_panel_userptr fails.
index f124803493d88b5eafb46572a199880125b4e903..4f026794e341774b177d5f0cf3bfdf3a233990b3 100644 (file)
@@ -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");
 }