[Python-checkins] [2.7] bpo-33677: Fix the signature of tp_clear handler for deque. (GH-7196). (GH-7277)

Serhiy Storchaka webhook-mailer at python.org
Thu May 31 03:32:47 EDT 2018


https://github.com/python/cpython/commit/db1074244d2c12961799f6f9353ae191f59cc497
commit: db1074244d2c12961799f6f9353ae191f59cc497
branch: 2.7
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018-05-31T10:32:43+03:00
summary:

[2.7] bpo-33677: Fix the signature of tp_clear handler for deque. (GH-7196). (GH-7277)

(cherry picked from commit a5c42284e69fb309bdd17ee8c1c120d1be383012)

files:
M Modules/_collectionsmodule.c

diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 2e4da4c211f8..9364aba549b1 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -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 *



More information about the Python-checkins mailing list