Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
review comments
  • Loading branch information
eendebakpt committed Jul 31, 2023
commit 0c050fc20234afeb939383edf886da016083df69
11 changes: 6 additions & 5 deletions Modules/_operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ typedef struct {
vectorcallfunc vectorcall;
} methodcallerobject;

static void* _methodcaller_initialize_vectorcall(methodcallerobject* mc)
static int _methodcaller_initialize_vectorcall(methodcallerobject* mc)
{
PyObject* args = mc->xargs;
PyObject* kwds = mc->kwds;
Expand All @@ -1567,7 +1567,8 @@ static void* _methodcaller_initialize_vectorcall(methodcallerobject* mc)
nargs + (kwds ? PyDict_Size(kwds) : 0),
sizeof(PyObject*));
if (!mc->vectorcall_args) {
return PyErr_NoMemory();
PyErr_NoMemory();
return -1;
}
/* The first item of vectorcall_args will be filled with obj later */
if (nargs > 1) {
Expand All @@ -1579,7 +1580,7 @@ static void* _methodcaller_initialize_vectorcall(methodcallerobject* mc)

mc->vectorcall_kwnames = PyTuple_New(nkwds);
if (!mc->vectorcall_kwnames) {
return NULL;
return -1;
}
Py_ssize_t i = 0, ppos = 0;
PyObject* key, * value;
Expand All @@ -1592,7 +1593,7 @@ static void* _methodcaller_initialize_vectorcall(methodcallerobject* mc)
else {
mc->vectorcall_kwnames = NULL;
}
return (void *)1;
return 1;
}


Expand All @@ -1605,7 +1606,7 @@ methodcaller_vectorcall(
return NULL;
}
if (mc->vectorcall_args == NULL) {
if (_methodcaller_initialize_vectorcall(mc) == NULL) {
if (_methodcaller_initialize_vectorcall(mc) < 0) {
return NULL;
}
}
Expand Down