Skip to content

Commit 8dca15c

Browse files
committed
Refactor error handling in _channelid_from_xid
1 parent 2ee769a commit 8dca15c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Modules/_interpchannelsmodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,7 @@ static PyObject *
25862586
_channelid_from_xid(_PyXIData_t *data)
25872587
{
25882588
struct _channelid_xid *xid = (struct _channelid_xid *)_PyXIData_DATA(data);
2589+
PyObject *cidobj = NULL;
25892590

25902591
// It might not be imported yet, so we can't use _get_current_module().
25912592
PyObject *mod = PyImport_ImportModule(MODULE_NAME_STR);
@@ -2595,12 +2596,10 @@ _channelid_from_xid(_PyXIData_t *data)
25952596
assert(mod != Py_None);
25962597
module_state *state = get_module_state(mod);
25972598
if (state == NULL) {
2598-
Py_DECREF(mod);
2599-
return NULL;
2599+
goto done;
26002600
}
26012601

26022602
// Note that we do not preserve the "resolve" flag.
2603-
PyObject *cidobj = NULL;
26042603
int err = newchannelid(state->ChannelIDType, xid->cid, xid->end,
26052604
_global_channels(), 0, 0,
26062605
(channelid **)&cidobj);

0 commit comments

Comments
 (0)