Skip to content
Merged
Show file tree
Hide file tree
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
Next Next commit
Convert _interpqueues._register_heap_types()
  • Loading branch information
AA-Turner committed Aug 12, 2025
commit 2fd1f9a0de79dff9d4cab8d4d3f756a66a390a3a
31 changes: 17 additions & 14 deletions Modules/_interpqueuesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1830,18 +1830,22 @@ _interpqueues_get_count_impl(PyObject *module, qidarg_converter_data qidarg)
return PyLong_FromSsize_t(count);
}

/*[clinic input]
_interpqueues._register_heap_types
queuetype: object
emptyerror: object
fullerror: object
Comment thread
AA-Turner marked this conversation as resolved.
Outdated

Return the number of items in the queue.
[clinic start generated code]*/

static PyObject *
queuesmod__register_heap_types(PyObject *self, PyObject *args, PyObject *kwds)
{
static char *kwlist[] = {"queuetype", "emptyerror", "fullerror", NULL};
PyObject *queuetype;
PyObject *emptyerror;
PyObject *fullerror;
if (!PyArg_ParseTupleAndKeywords(args, kwds,
"OOO:_register_heap_types", kwlist,
&queuetype, &emptyerror, &fullerror)) {
return NULL;
}
_interpqueues__register_heap_types_impl(PyObject *module,
PyObject *queuetype,
PyObject *emptyerror,
PyObject *fullerror)
/*[clinic end generated code: output=8d7b129b64dcd01f input=878c5f97c09404bf]*/
{
if (!PyType_Check(queuetype)) {
PyErr_SetString(PyExc_TypeError,
"expected a type for 'queuetype'");
Expand All @@ -1858,7 +1862,7 @@ queuesmod__register_heap_types(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}

module_state *state = get_module_state(self);
module_state *state = get_module_state(module);

if (set_external_queue_type(state, (PyTypeObject *)queuetype) < 0) {
return NULL;
Expand All @@ -1882,8 +1886,7 @@ static PyMethodDef module_functions[] = {
_INTERPQUEUES_GET_QUEUE_DEFAULTS_METHODDEF
_INTERPQUEUES_IS_FULL_METHODDEF
_INTERPQUEUES_GET_COUNT_METHODDEF
{"_register_heap_types", _PyCFunction_CAST(queuesmod__register_heap_types),
METH_VARARGS | METH_KEYWORDS, NULL},
_INTERPQUEUES__REGISTER_HEAP_TYPES_METHODDEF

{NULL, NULL} /* sentinel */
};
Expand Down
67 changes: 66 additions & 1 deletion Modules/clinic/_interpqueuesmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.