summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-24 18:47:40 (GMT)
committerGuido van Rossum <guido@python.org>2001-09-24 18:47:40 (GMT)
commit3d45d8f12ea3b4180ed2e1539aa28e14a150b5ba (patch)
treeb407f8b86d55b0420629477c4ca0ca0db77bda68 /Objects
parent2d879017b3a259e13b1e1cec5b8bc652432c1849 (diff)
downloadcpython-3d45d8f12ea3b4180ed2e1539aa28e14a150b5ba.zip
cpython-3d45d8f12ea3b4180ed2e1539aa28e14a150b5ba.tar.gz
cpython-3d45d8f12ea3b4180ed2e1539aa28e14a150b5ba.tar.bz2
Another comparison patch-up: comparing a type with a dynamic metatype
to one with a static metatype raised an obscure error.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 20c149e..027a568 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2033,7 +2033,8 @@ wrap_cmpfunc(PyObject *self, PyObject *args, void *wrapped)
if (!PyArg_ParseTuple(args, "O", &other))
return NULL;
- if (!PyType_IsSubtype(other->ob_type, self->ob_type)) {
+ if (other->ob_type->tp_compare != func &&
+ !PyType_IsSubtype(other->ob_type, self->ob_type)) {
PyErr_Format(
PyExc_TypeError,
"%s.__cmp__(x,y) requires y to be a '%s', not a '%s'",