mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Another comparison patch-up: comparing a type with a dynamic metatype
to one with a static metatype raised an obscure error.
This commit is contained in:
parent
2d879017b3
commit
3d45d8f12e
2 changed files with 9 additions and 1 deletions
|
@ -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'",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue