RichCompare and RichCompareBool

Aaron Brady castironpi at
Mon Mar 2 11:33:20 CET 2009


In the source for 3.0.1, PyObject_RichCompareBool seems to perform an
extra check on identity that PyObjecct_RichCompare does not perform.

Here's the excerpt from RichCompareBool (line 612):

	/* 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;

	res = PyObject_RichCompare(v, w, op);

The code for PyObject_RichCompare does not contain this, it doesn't
seem.  Is it a bug?

More information about the Python-list mailing list