Commit 8c313cce authored by Jim Fulton's avatar Jim Fulton

Make chack for default comparison work for Python 2.5.

parent bb5aac21
...@@ -9,10 +9,20 @@ static PyObject *object_; ...@@ -9,10 +9,20 @@ static PyObject *object_;
static int static int
check_argument_cmp(PyObject *arg) check_argument_cmp(PyObject *arg)
{ {
/* printf("check cmp %p %p %p %p\n", */
/* arg->ob_type->tp_richcompare, */
/* ((PyTypeObject *)object_)->ob_type->tp_richcompare, */
/* arg->ob_type->tp_compare, */
/* ((PyTypeObject *)object_)->ob_type->tp_compare); */
if (arg->ob_type->tp_richcompare == NULL if (arg->ob_type->tp_richcompare == NULL
&& &&
#if PY_MAJOR_VERSION==2 && PY_MINOR_VERSION < 6
arg->ob_type->tp_compare == NULL
#else
arg->ob_type->tp_compare == arg->ob_type->tp_compare ==
((PyTypeObject *)object_)->ob_type->tp_compare ((PyTypeObject *)object_)->ob_type->tp_compare
#endif
) )
{ {
PyErr_SetString(PyExc_TypeError, "Object has default comparison"); PyErr_SetString(PyExc_TypeError, "Object has default comparison");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment