mirror of
https://github.com/python/cpython.git
synced 2025-09-30 12:21:51 +00:00
bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196)
(cherry picked from commit a5c42284e6
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
e76b8c4464
commit
a4dd46a47f
3 changed files with 8 additions and 5 deletions
|
@ -575,7 +575,7 @@ deque_concat(dequeobject *deque, PyObject *other)
|
||||||
return new_deque;
|
return new_deque;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
deque_clear(dequeobject *deque)
|
deque_clear(dequeobject *deque)
|
||||||
{
|
{
|
||||||
block *b;
|
block *b;
|
||||||
|
@ -587,7 +587,7 @@ deque_clear(dequeobject *deque)
|
||||||
PyObject **itemptr, **limit;
|
PyObject **itemptr, **limit;
|
||||||
|
|
||||||
if (Py_SIZE(deque) == 0)
|
if (Py_SIZE(deque) == 0)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
/* During the process of clearing a deque, decrefs can cause the
|
/* During the process of clearing a deque, decrefs can cause the
|
||||||
deque to mutate. To avoid fatal confusion, we have to make 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);
|
CHECK_END(leftblock->rightlink);
|
||||||
freeblock(leftblock);
|
freeblock(leftblock);
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
alternate_method:
|
alternate_method:
|
||||||
while (Py_SIZE(deque)) {
|
while (Py_SIZE(deque)) {
|
||||||
|
@ -656,6 +656,7 @@ deque_clear(dequeobject *deque)
|
||||||
assert (item != NULL);
|
assert (item != NULL);
|
||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
|
@ -647,10 +647,11 @@ ast_traverse(AST_object *self, visitproc visit, void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
ast_clear(AST_object *self)
|
ast_clear(AST_object *self)
|
||||||
{
|
{
|
||||||
Py_CLEAR(self->dict);
|
Py_CLEAR(self->dict);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -528,10 +528,11 @@ ast_traverse(AST_object *self, visitproc visit, void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
ast_clear(AST_object *self)
|
ast_clear(AST_object *self)
|
||||||
{
|
{
|
||||||
Py_CLEAR(self->dict);
|
Py_CLEAR(self->dict);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue