diff Objects/funcobject.c @ 44021:ff5df1fc0fcc

Patch from Georg Brandl and me for #1493 Remove unbound method objects
author Christian Heimes <christian@cheimes.de>
date Sun, 25 Nov 2007 09:39:14 +0000
parents 483e958d13c7
children 48af6375207e
line wrap: on
line diff
--- a/Objects/funcobject.c	Sun Nov 25 09:18:01 2007 +0000
+++ b/Objects/funcobject.c	Sun Nov 25 09:39:14 2007 +0000
@@ -643,8 +643,10 @@
 static PyObject *
 func_descr_get(PyObject *func, PyObject *obj, PyObject *type)
 {
-	if (obj == Py_None)
-		obj = NULL;
+	if (obj == Py_None || obj == NULL) {
+		Py_INCREF(func);
+		return func;
+	}
 	return PyMethod_New(func, obj, type);
 }