summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-12-13 16:36:53 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-12-13 16:36:53 (GMT)
commit4895af4ef1c91679e642c0fc81f584aecc26a7ea (patch)
treee854f0d7770beff477fd7ee94540b2e15524bddd /Objects
parent2a08b42e9523b9642c72c15dffc41e8e442b4e72 (diff)
downloadcpython-4895af4ef1c91679e642c0fc81f584aecc26a7ea.zip
cpython-4895af4ef1c91679e642c0fc81f584aecc26a7ea.tar.gz
cpython-4895af4ef1c91679e642c0fc81f584aecc26a7ea.tar.bz2
fix the ignoring of __cmp__ method on metaclasses #7491
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 8c49096..8ef23d5 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -628,7 +628,11 @@ type_richcompare(PyObject *v, PyObject *w, int op)
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;
}