diff Objects/classobject.c @ 47259:770e4e132775

#2964: fix missing INCREF.
author Georg Brandl <georg@python.org>
date Sun, 25 May 2008 09:24:38 +0000
parents 7c4c46342137
children 87fbbf22adf3
line wrap: on
line diff
--- a/Objects/classobject.c	Sun May 25 07:45:51 2008 +0000
+++ b/Objects/classobject.c	Sun May 25 09:24:38 2008 +0000
@@ -501,8 +501,10 @@
 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);
 }