]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-33677: Fix the signature of tp_clear handler for deque. (GH-7196). (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 31 May 2018 07:32:43 +0000 (10:32 +0300)
committerGitHub <noreply@github.com>
Thu, 31 May 2018 07:32:43 +0000 (10:32 +0300)
(cherry picked from commit a5c42284e69fb309bdd17ee8c1c120d1be383012)

Modules/_collectionsmodule.c

index 2e4da4c211f88f4c5b2e9890df4f4d1a97420450..9364aba549b1c1be8a213852fc572d3b15d230da 100644 (file)
@@ -639,7 +639,7 @@ deque_remove(dequeobject *deque, PyObject *value)
 PyDoc_STRVAR(remove_doc,
 "D.remove(value) -- remove first occurrence of value.");
 
-static void
+static int
 deque_clear(dequeobject *deque)
 {
     block *b;
@@ -650,7 +650,7 @@ deque_clear(dequeobject *deque)
     PyObject *item;
 
     if (deque->len == 0)
-        return;
+        return 0;
 
     /* During the process of clearing a deque, decrefs can cause the
        deque to mutate.  To avoid fatal confusion, we have to make the
@@ -701,7 +701,7 @@ deque_clear(dequeobject *deque)
     }
     assert(leftblock->rightlink == NULL);
     freeblock(leftblock);
-    return;
+    return 0;
 
   alternate_method:
     while (deque->len) {
@@ -709,6 +709,7 @@ deque_clear(dequeobject *deque)
         assert (item != NULL);
         Py_DECREF(item);
     }
+    return 0;
 }
 
 static PyObject *