diff Objects/typeobject.c @ 57694:0dbeccd7e0e6 2.6

Merged revisions 76794 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76794 | benjamin.peterson | 2009-12-13 10:36:53 -0600 (Sun, 13 Dec 2009) | 2 lines fix the ignoring of __cmp__ method on metaclasses #7491 ........
author Benjamin Peterson <benjamin@python.org>
date Sun, 13 Dec 2009 16:41:44 +0000
parents 642910a01d7f
children 942823ddd818
line wrap: on
line diff
--- a/Objects/typeobject.c	Sun Dec 13 16:19:43 2009 +0000
+++ b/Objects/typeobject.c	Sun Dec 13 16:41:44 2009 +0000
@@ -645,7 +645,11 @@
 	int c;
 
 	/* Make sure both arguments are types. */
-	if (!PyType_Check(v) || !PyType_Check(w)) {
+	if (!PyType_Check(v) || !PyType_Check(w) ||
+	    /* If there is a __cmp__ method defined, let it be called instead
+	       of our dumb function designed merely to warn.  See bug
+	       #7491. */
+	    Py_TYPE(v)->tp_compare || Py_TYPE(w)->tp_compare) {
 		result = Py_NotImplemented;
 		goto out;
 	}