aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-25 09:24:38 +0000
committerGeorg Brandl <georg@python.org>2008-05-25 09:24:38 +0000
commitc9b0953bda1339137a7280ab1b1085abbdf4977a (patch)
tree48054e8a21b63cfb3d901133d0cda75aaf57e220 /Objects/classobject.c
parent#2879: rename _winreg to winreg. (diff)
downloadcpython-c9b0953bda1339137a7280ab1b1085abbdf4977a.tar.gz
cpython-c9b0953bda1339137a7280ab1b1085abbdf4977a.tar.bz2
cpython-c9b0953bda1339137a7280ab1b1085abbdf4977a.zip
#2964: fix missing INCREF.
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 0e131eb1c1b..3c2bc3d0331 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -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);
}