summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-03-01 11:41:03 (GMT)
committerGitHub <noreply@github.com>2017-03-01 11:41:03 (GMT)
commit3824cd8fd44f287ea2a76120a39ee76eb34bbf32 (patch)
tree3d88f703e85652986a8fb123f6196be470884f83 /Objects
parentf5184745a502a38284ce54732913a4381a45daac (diff)
downloadcpython-3824cd8fd44f287ea2a76120a39ee76eb34bbf32.zip
cpython-3824cd8fd44f287ea2a76120a39ee76eb34bbf32.tar.gz
cpython-3824cd8fd44f287ea2a76120a39ee76eb34bbf32.tar.bz2
bpo-29684: Fix regression of PyEval_CallObjectWithKeywords (GH-87)
It should raise TypeError when kwargs is not a dict.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/call.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Objects/call.c b/Objects/call.c
index 310b4a2..a4af816 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -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);
+ }
}