mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
only order comparisons are removed in py3k #6119
This commit is contained in:
parent
0c6de43dd9
commit
1bf4765369
3 changed files with 20 additions and 7 deletions
|
@ -230,12 +230,9 @@ meth_richcompare(PyObject *self, PyObject *other, int op)
|
|||
PyObject *res;
|
||||
int eq;
|
||||
|
||||
if ((op != Py_EQ && op != Py_NE) ||
|
||||
!PyCFunction_Check(self) ||
|
||||
!PyCFunction_Check(other))
|
||||
{
|
||||
/* Py3K warning if types are not equal and comparison isn't == or != */
|
||||
if (PyErr_WarnPy3k("builtin_function_or_method inequality "
|
||||
if (op != Py_EQ && op != Py_NE) {
|
||||
/* Py3K warning if comparison isn't == or !=. */
|
||||
if (PyErr_WarnPy3k("builtin_function_or_method order "
|
||||
"comparisons not supported in 3.x", 1) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -243,6 +240,10 @@ meth_richcompare(PyObject *self, PyObject *other, int op)
|
|||
Py_INCREF(Py_NotImplemented);
|
||||
return Py_NotImplemented;
|
||||
}
|
||||
else if (!PyCFunction_Check(self) || !PyCFunction_Check(other)) {
|
||||
Py_INCREF(Py_NotImplemented);
|
||||
return Py_NotImplemented;
|
||||
}
|
||||
a = (PyCFunctionObject *)self;
|
||||
b = (PyCFunctionObject *)other;
|
||||
eq = a->m_self == b->m_self;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue