From 0fe3be03926c3468ed4c10980d1a030c8ef4e37e Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 30 May 2018 23:10:28 -0700 Subject: bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196) (GH-7269) (cherry picked from commit a5c42284e69fb309bdd17ee8c1c120d1be383012) Co-authored-by: Serhiy Storchaka --- Modules/_collectionsmodule.c | 7 ++++--- Parser/asdl_c.py | 3 ++- Python/Python-ast.c | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index af20d6e..d7b344b 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -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 * diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 6302af6..90c5fea 100644 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -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 diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 212211c..8e383ad 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -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 -- cgit v0.12