Skip to content
Closed
Show file tree
Hide file tree
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
gh-110266: Fix "get_module_from_owned_type is unused" warning
  • Loading branch information
sobolevn committed Oct 3, 2023
commit 3c46ef77a34eb5ff0f40f3cdfa9ec0c7e6d3676c
3 changes: 3 additions & 0 deletions Modules/_testinternalcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
static PyObject *
_get_current_module(void)
{
// XXX Use the more efficient API now that we use heap types:
// return PyType_GetModule(cls);

// We ensured it was imported in _run_script().
PyObject *name = PyUnicode_FromString(MODULE_NAME);
if (name == NULL) {
Expand Down
12 changes: 2 additions & 10 deletions Modules/_xxinterpchannelsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ _get_current_module(void)
return mod;
}

static PyObject *
get_module_from_owned_type(PyTypeObject *cls)
{
assert(cls != NULL);
return _get_current_module();
// XXX Use the more efficient API now that we use heap types:
//return PyType_GetModule(cls);
}

static struct PyModuleDef moduledef;

static PyObject *
Expand Down Expand Up @@ -2464,7 +2455,8 @@ channel__channel_id(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}
PyTypeObject *cls = state->ChannelIDType;
assert(get_module_from_owned_type(cls) == self);
assert(cls != NULL);
assert(_get_current_module() == self);

return _channelid_new(self, cls, args, kwds);
}
Expand Down