Inada Naoki <songofaca...@gmail.com> added the comment:

Would you benchmark the performance?

How about calling Py_INCREF and Py_DECREF in PyObject_RichCompare or 
do_richcompare?

It is safer than checking all caller of the PyObject_RichCompare and 
PyObject_RichCompareBool.
And it would be faster when PyObject_RichCompareBool is called with v == w and 
op == Py_EQ.

    /* Quick result when objects are the same.
       Guarantees that identity implies equality. */
    if (v == w) {
        if (op == Py_EQ)
            return 1;
        else if (op == Py_NE)
            return 0;
    }

----------
nosy: +inada.naoki

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38588>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to