mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-29684: Fix regression of PyEval_CallObjectWithKeywords (GH-87)
It should raise TypeError when kwargs is not a dict.
This commit is contained in:
parent
f5184745a5
commit
3824cd8fd4
2 changed files with 11 additions and 6 deletions
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue