[Python-3000-checkins] r63620 - in python/branches/py3k: Misc/NEWS Objects/classobject.c

georg.brandl python-3000-checkins at python.org
Sun May 25 11:24:39 CEST 2008


Author: georg.brandl
Date: Sun May 25 11:24:38 2008
New Revision: 63620

Log:
#2964: fix missing INCREF.


Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Objects/classobject.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sun May 25 11:24:38 2008
@@ -12,6 +12,8 @@
 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

Modified: python/branches/py3k/Objects/classobject.c
==============================================================================
--- python/branches/py3k/Objects/classobject.c	(original)
+++ python/branches/py3k/Objects/classobject.c	Sun May 25 11:24:38 2008
@@ -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);
 }


More information about the Python-3000-checkins mailing list