[Python-checkins] bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196)

Serhiy Storchaka webhook-mailer at python.org
Thu May 31 00:34:38 EDT 2018


https://github.com/python/cpython/commit/a5c42284e69fb309bdd17ee8c1c120d1be383012
commit: a5c42284e69fb309bdd17ee8c1c120d1be383012
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018-05-31T07:34:34+03:00
summary:

bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196)

files:
M Modules/_collectionsmodule.c
M Parser/asdl_c.py
M Python/Python-ast.c

diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 55132e786d5b..65d556c5a0e5 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -575,7 +575,7 @@ deque_concat(dequeobject *deque, PyObject *other)
     return new_deque;
 }
 
-static void
+static int
 deque_clear(dequeobject *deque)
 {
     block *b;
@@ -587,7 +587,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
@@ -648,7 +648,7 @@ deque_clear(dequeobject *deque)
     }
     CHECK_END(leftblock->rightlink);
     freeblock(leftblock);
-    return;
+    return 0;
 
   alternate_method:
     while (Py_SIZE(deque)) {
@@ -656,6 +656,7 @@ deque_clear(dequeobject *deque)
         assert (item != NULL);
         Py_DECREF(item);
     }
+    return 0;
 }
 
 static PyObject *
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 399e79e0597f..44e3d40c6155 100644
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -647,10 +647,11 @@ def visitModule(self, mod):
     return 0;
 }
 
-static void
+static int
 ast_clear(AST_object *self)
 {
     Py_CLEAR(self->dict);
+    return 0;
 }
 
 static int
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 38b9292577f2..6a2f28e0e712 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -528,10 +528,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



More information about the Python-checkins mailing list