Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ deque_remove(dequeobject *deque, PyObject *value)
PyDoc_STRVAR(remove_doc,
"D.remove(value) -- remove first occurrence of value.");

static void
static int
deque_clear(dequeobject *deque)
{
block *b;
Expand All @@ -650,7 +650,7 @@ deque_clear(dequeobject *deque)
PyObject *item;

if (deque->len == 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
Expand Down Expand Up @@ -701,14 +701,15 @@ deque_clear(dequeobject *deque)
}
assert(leftblock->rightlink == NULL);
freeblock(leftblock);
return;
return 0;

alternate_method:
while (deque->len) {
item = deque_pop(deque, NULL);
assert (item != NULL);
Py_DECREF(item);
}
return 0;
}

static PyObject *
Expand Down