summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/listobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index abe2604..bc8425c 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2664,6 +2664,9 @@ list_richcompare(PyObject *v, PyObject *w, int op)
for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) {
PyObject *vitem = vl->ob_item[i];
PyObject *witem = wl->ob_item[i];
+ if (vitem == witem) {
+ continue;
+ }
Py_INCREF(vitem);
Py_INCREF(witem);