[Python-checkins] r72692 - python/trunk/Objects/abstract.c

benjamin.peterson python-checkins at python.org
Sun May 17 00:30:49 CEST 2009


Author: benjamin.peterson
Date: Sun May 17 00:30:48 2009
New Revision: 72692

Log:
deal with old-style classes in issubclass and isinstance

Modified:
   python/trunk/Objects/abstract.c

Modified: python/trunk/Objects/abstract.c
==============================================================================
--- python/trunk/Objects/abstract.c	(original)
+++ python/trunk/Objects/abstract.c	Sun May 17 00:30:48 2009
@@ -2927,7 +2927,7 @@
 		return r;
 	}
 
-	if (PyInstance_Check(cls)) {
+	if (PyClass_Check(cls) || PyInstance_Check(cls)) {
 		checker = PyObject_GetAttrString(cls, "__instancecheck__");
 		if (checker == NULL) {
 			if (PyErr_ExceptionMatches(PyExc_AttributeError))
@@ -3013,7 +3013,7 @@
  		Py_LeaveRecursiveCall();
  		return r;
  	}
-	if (PyInstance_Check(cls)) {
+	if (PyClass_Check(cls) || PyInstance_Check(cls)) {
 		PyErr_Fetch(&t, &v, &tb);
 		checker = PyObject_GetAttr(cls, name);
 		if (checker == NULL &&


More information about the Python-checkins mailing list