Skip to content

Commit b1c53b2

Browse files
committed
comment
1 parent c703f61 commit b1c53b2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Objects/tupleobject.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ tuple_richcompare(PyObject *v, PyObject *w, int op)
666666
if (!PyTuple_Check(v) || !PyTuple_Check(w))
667667
Py_RETURN_NOTIMPLEMENTED;
668668

669+
/* Fast path based on identity: if both objects are the same tuple
670+
* object, we return immediately without comparing items. Elements that
671+
* are not equal to themselves (see check_compare_id in
672+
* Lib/tests/seq_tests.py) are therefore treated as equal here.
673+
*/
669674
if (v == w) {
670675
Py_RETURN_RICHCOMPARE(0, 0, op);
671676
}

0 commit comments

Comments
 (0)