]> granicus.if.org Git - python/commitdiff
bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196) (GH-7269)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 31 May 2018 06:10:28 +0000 (23:10 -0700)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 31 May 2018 06:10:28 +0000 (09:10 +0300)
(cherry picked from commit a5c42284e69fb309bdd17ee8c1c120d1be383012)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Modules/_collectionsmodule.c
Parser/asdl_c.py
Python/Python-ast.c

index af20d6edd9185915b4ddb089eef0b1bf2aefb5c0..d7b344be692c1d6e043abb37497be895552421d1 100644 (file)
@@ -574,7 +574,7 @@ deque_concat(dequeobject *deque, PyObject *other)
     return new_deque;
 }
 
-static void
+static int
 deque_clear(dequeobject *deque)
 {
     block *b;
@@ -586,7 +586,7 @@ deque_clear(dequeobject *deque)
     PyObject **itemptr, **limit;
 
     if (Py_SIZE(deque) == 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
@@ -647,7 +647,7 @@ deque_clear(dequeobject *deque)
     }
     CHECK_END(leftblock->rightlink);
     freeblock(leftblock);
-    return;
+    return 0;
 
   alternate_method:
     while (Py_SIZE(deque)) {
@@ -655,6 +655,7 @@ deque_clear(dequeobject *deque)
         assert (item != NULL);
         Py_DECREF(item);
     }
+    return 0;
 }
 
 static PyObject *
index 6302af6fa3e3378a32b67c82875e842ed025681a..90c5feaa7e714ba1bc2058310d00b0abcb04b889 100644 (file)
@@ -643,10 +643,11 @@ ast_traverse(AST_object *self, visitproc visit, void *arg)
     return 0;
 }
 
-static void
+static int
 ast_clear(AST_object *self)
 {
     Py_CLEAR(self->dict);
+    return 0;
 }
 
 static int
index 212211c5f435cfaf5eac133ce886f1f1ed0e7e9f..8e383ad14cae5b3c092c21c9055587fcc69f0029 100644 (file)
@@ -525,10 +525,11 @@ ast_traverse(AST_object *self, visitproc visit, void *arg)
     return 0;
 }
 
-static void
+static int
 ast_clear(AST_object *self)
 {
     Py_CLEAR(self->dict);
+    return 0;
 }
 
 static int