RichCompare and RichCompareBool

Aaron Brady castironpi at gmail.com
Mon Mar 2 05:33:20 EST 2009


Hi,

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