[Python-checkins] bpo-39737: Remove code repitition in list_richcompare (GH-18638)

sweeneyde webhook-mailer at python.org
Wed Feb 26 02:00:40 EST 2020


https://github.com/python/cpython/commit/be7ead62db9a1db3e2cd997b0beffd4480e51f5c
commit: be7ead62db9a1db3e2cd997b0beffd4480e51f5c
branch: master
author: sweeneyde <36520290+sweeneyde at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-02-26T09:00:35+02:00
summary:

bpo-39737: Remove code repitition in list_richcompare (GH-18638)

I may speed up list comparison on some platforms.

files:
M Objects/listobject.c

diff --git a/Objects/listobject.c b/Objects/listobject.c
index 3c39c6444bfd6..3ac03b71d03ac 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2643,8 +2643,7 @@ list_richcompare(PyObject *v, PyObject *w, int op)
 
         Py_INCREF(vitem);
         Py_INCREF(witem);
-        int k = PyObject_RichCompareBool(vl->ob_item[i],
-                                         wl->ob_item[i], Py_EQ);
+        int k = PyObject_RichCompareBool(vitem, witem, Py_EQ);
         Py_DECREF(vitem);
         Py_DECREF(witem);
         if (k < 0)



More information about the Python-checkins mailing list