Skip to content

Commit

Permalink
bpo-29684: Fix minor regression of PyEval_CallObjectWithKeywords
Browse files Browse the repository at this point in the history
It should raise TypeError when kwargs is not a dict.
  • Loading branch information
methane committed Mar 1, 2017
1 parent 43f5df5 commit 33a56b7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Objects/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,11 +766,7 @@ PyEval_CallObjectWithKeywords(PyObject *callable,
assert(!PyErr_Occurred());
#endif

if (args == NULL) {
return _PyObject_FastCallDict(callable, NULL, 0, kwargs);
}

if (!PyTuple_Check(args)) {
if (args != NULL && !PyTuple_Check(args)) {
PyErr_SetString(PyExc_TypeError,
"argument list must be a tuple");
return NULL;
Expand All @@ -782,7 +778,12 @@ PyEval_CallObjectWithKeywords(PyObject *callable,
return NULL;
}

return PyObject_Call(callable, args, kwargs);
if (args == NULL) {
return _PyObject_FastCallDict(callable, NULL, 0, kwargs);
}
else {
return PyObject_Call(callable, args, kwargs);
}
}


Expand Down

0 comments on commit 33a56b7

Please sign in to comment.