8000 bpo-40077: Convert _queuemodule to use heap types by erlend-aasland · Pull Request #23136 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40077: Convert _queuemodule to use heap types #23136

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 5 commits into from
Nov 7, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Address review: Add module m_traverse/m_clear/m_free
  • Loading branch information
Erlend E. Aasland committed Nov 5, 2020
commit b939524847d1c085fdde55d3dd2e3ff39de3f89f
26 changes: 26 additions & 0 deletions Modules/_queuemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,29 @@ _queue_SimpleQueue_qsize_impl(simplequeueobject *self)
return PyList_GET_SIZE(self->lst) - self->lst_pos;
}

static int
queue_traverse(PyObject *m, visitproc visit, void *arg)
{
simplequeue_state *state = simplequeue_get_state(m);
Py_VISIT(state->SimpleQueueType);
Py_VISIT(state->EmptyError);
return 0;
}

static int
queue_clear(PyObject *m)
{
simplequeue_state *state = simplequeue_get_state(m);
Py_CLEAR(state->SimpleQueueType);
Py_CLEAR(state->EmptyError);
return 0;
}

static void
queue_free(void *m)
{
queue_clear((PyObject *)m);
}

#include "clinic/_queuemodule.c.h"

Expand Down Expand Up @@ -363,6 +386,9 @@ static struct PyModuleDef queuemodule = {
.m_name = "_queue",
.m_doc = queue_module_doc,
.m_size = sizeof(simplequeue_state),
.m_traverse = queue_traverse,
.m_clear = queue_clear,
.m_free = queue_free,
};


Expand Down
0