[Python-checkins] cpython: Improve variable names and constant expressions

raymond.hettinger python-checkins at python.org
Thu Oct 15 02:17:04 EDT 2015


https://hg.python.org/cpython/rev/7205cebb9a3e
changeset:   98761:7205cebb9a3e
user:        Raymond Hettinger <python at rcn.com>
date:        Wed Oct 14 23:16:57 2015 -0700
summary:
  Improve variable names and constant expressions

files:
  Modules/_collectionsmodule.c |  20 +++++++++++---------
  1 files changed, 11 insertions(+), 9 deletions(-)


diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -303,8 +303,8 @@
     deque->rightindex++;
     deque->rightblock->data[deque->rightindex] = item;
     if (NEEDS_TRIM(deque, deque->maxlen)) {
-        PyObject *rv = deque_popleft(deque, NULL);
-        Py_DECREF(rv);
+        PyObject *olditem = deque_popleft(deque, NULL);
+        Py_DECREF(olditem);
     }
     Py_RETURN_NONE;
 }
@@ -331,8 +331,8 @@
     deque->leftindex--;
     deque->leftblock->data[deque->leftindex] = item;
     if (NEEDS_TRIM(deque, deque->maxlen)) {
-        PyObject *rv = deque_pop(deque, NULL);
-        Py_DECREF(rv);
+        PyObject *olditem = deque_pop(deque, NULL);
+        Py_DECREF(olditem);
     }
     Py_RETURN_NONE;
 }
@@ -423,8 +423,8 @@
         deque->rightindex++;
         deque->rightblock->data[deque->rightindex] = item;
         if (NEEDS_TRIM(deque, maxlen)) {
-            PyObject *rv = deque_popleft(deque, NULL);
-            Py_DECREF(rv);
+            PyObject *olditem = deque_popleft(deque, NULL);
+            Py_DECREF(olditem);
         }
     }
     return finalize_iterator(it);
@@ -487,8 +487,8 @@
         deque->leftindex--;
         deque->leftblock->data[deque->leftindex] = item;
         if (NEEDS_TRIM(deque, maxlen)) {
-            PyObject *rv = deque_pop(deque, NULL);
-            Py_DECREF(rv);
+            PyObject *olditem = deque_pop(deque, NULL);
+            Py_DECREF(olditem);
         }
     }
     return finalize_iterator(it);
@@ -1283,6 +1283,7 @@
     PyObject *item;
     Py_ssize_t index;
     Py_ssize_t indexlo = deque->leftindex;
+    Py_ssize_t indexhigh;
 
     for (b = deque->leftblock; b != deque->rightblock; b = b->rightlink) {
         for (index = indexlo; index < BLOCKLEN ; index++) {
@@ -1291,7 +1292,8 @@
         }
         indexlo = 0;
     }
-    for (index = indexlo; index <= deque->rightindex; index++) {
+    indexhigh = deque->rightindex;
+    for (index = indexlo; index <= indexhigh; index++) {
         item = b->data[index];
         Py_VISIT(item);
     }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list