]> granicus.if.org Git - python/commitdiff
#2964: fix missing INCREF.
authorGeorg Brandl <georg@python.org>
Sun, 25 May 2008 09:24:38 +0000 (09:24 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 25 May 2008 09:24:38 +0000 (09:24 +0000)
Misc/NEWS
Objects/classobject.c

index f385560202c3d062b12d016075f8631f56d3f3f8..08bd0924d7e3b77c698b7a652f201e08c57a8088 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's new in Python 3.0b1?
 Core and Builtins
 -----------------
 
+- Issue #2964: fix a missing INCREF in instancemethod_descr_get.
+
 - Issue 2895: Don't crash when given bytes objects as keyword names.
 
 - Issue 2798: When parsing arguments with PyArg_ParseTuple, the "s" code now
index 0e131eb1c1bf6c34bc539a4df6a2f830d49d07c2..3c2bc3d0331022a61e1a0e2cd285f79ed74e11b8 100644 (file)
@@ -501,8 +501,10 @@ instancemethod_call(PyObject *self, PyObject *arg, PyObject *kw)
 static PyObject *
 instancemethod_descr_get(PyObject *descr, PyObject *obj, PyObject *type) {
        register PyObject *func = PyInstanceMethod_GET_FUNCTION(descr);
-       if (obj == NULL)
+       if (obj == NULL) {
+               Py_INCREF(func);
                return func;
+       }
        else
                return PyMethod_New(func, obj);
 }