diff Objects/funcobject.c @ 22367:f2b6ccc00808 legacy-trunk

Fix for SF bug 528132 (Armin Rigo): classmethod().__get__() segfault The proper fix is not quite what was submitted; it's really better to take the class of the object passed rather than calling PyMethod_New with NULL pointer args, because that can then cause other core dumps later. I also added a testcase for the fix to classmethods() in test_descr.py. I've already applied this to the 2.2 branch.
author Guido van Rossum <guido@python.org>
date Mon, 18 Mar 2002 03:09:06 +0000
parents 77c7476f41bd
children bae67e414a13 d99a1ddf9518
line wrap: on
line diff
--- a/Objects/funcobject.c	Mon Mar 18 03:07:20 2002 +0000
+++ b/Objects/funcobject.c	Mon Mar 18 03:09:06 2002 +0000
@@ -474,6 +474,8 @@
 				"uninitialized classmethod object");
 		return NULL;
 	}
+	if (type == NULL)
+		type = (PyObject *)(obj->ob_type);
  	return PyMethod_New(cm->cm_callable,
 			    type, (PyObject *)(type->ob_type));
 }