bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196)
(cherry picked from commit a5c42284e69fb309bdd17ee8c1c120d1be383012)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 5753dd9..4116d40 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -575,7 +575,7 @@
return new_deque;
}
-static void
+static int
deque_clear(dequeobject *deque)
{
block *b;
@@ -587,7 +587,7 @@
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 @@
}
CHECK_END(leftblock->rightlink);
freeblock(leftblock);
- return;
+ return 0;
alternate_method:
while (Py_SIZE(deque)) {
@@ -656,6 +656,7 @@
assert (item != NULL);
Py_DECREF(item);
}
+ return 0;
}
static PyObject *