mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
fix the ignoring of __cmp__ method on metaclasses #7491
This commit is contained in:
parent
2a08b42e95
commit
4895af4ef1
3 changed files with 16 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue