[Python-checkins] cpython: Minor nit. Make the rotate() success/fail tests consistent.

raymond.hettinger python-checkins at python.org
Sat Mar 21 10:04:00 CET 2015


https://hg.python.org/cpython/rev/a5dc5867d5e8
changeset:   95114:a5dc5867d5e8
user:        Raymond Hettinger <python at rcn.com>
date:        Sat Mar 21 02:03:40 2015 -0700
summary:
  Minor nit.  Make the rotate() success/fail tests consistent.

files:
  Modules/_collectionsmodule.c |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -634,7 +634,7 @@
 
     if (!PyArg_ParseTuple(args, "|n:rotate", &n))
         return NULL;
-    if (_deque_rotate(deque, n) == 0)
+    if (!_deque_rotate(deque, n))
         Py_RETURN_NONE;
     return NULL;
 }
@@ -864,7 +864,7 @@
         if (cmp > 0) {
             PyObject *tgt = deque_popleft(deque, NULL);
             assert (tgt != NULL);
-            if (_deque_rotate(deque, i) == -1)
+            if (_deque_rotate(deque, i))
                 return NULL;
             Py_DECREF(tgt);
             Py_RETURN_NONE;
@@ -959,7 +959,7 @@
     int rv;
 
     assert (i >= 0 && i < Py_SIZE(deque));
-    if (_deque_rotate(deque, -i) == -1)
+    if (_deque_rotate(deque, -i))
         return -1;
     item = deque_popleft(deque, NULL);
     rv = _deque_rotate(deque, i);

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


More information about the Python-checkins mailing list