mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
Merge branch changes (coercion, rich comparisons) into trunk.
This commit is contained in:
parent
33f4d6d1db
commit
2ed6bf87c9
4 changed files with 106 additions and 11 deletions
|
@ -365,6 +365,14 @@ try_rich_compare(PyObject *v, PyObject *w, int op)
|
|||
richcmpfunc f;
|
||||
PyObject *res;
|
||||
|
||||
if (v->ob_type != w->ob_type &&
|
||||
PyType_IsSubtype(w->ob_type, v->ob_type) &&
|
||||
(f = RICHCOMPARE(w->ob_type)) != NULL) {
|
||||
res = (*f)(w, v, swapped_op[op]);
|
||||
if (res != Py_NotImplemented)
|
||||
return res;
|
||||
Py_DECREF(res);
|
||||
}
|
||||
if ((f = RICHCOMPARE(v->ob_type)) != NULL) {
|
||||
res = (*f)(v, w, op);
|
||||
if (res != Py_NotImplemented)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue