summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-08-04 04:14:47 (GMT)
committerGuido van Rossum <guido@python.org>1995-08-04 04:14:47 (GMT)
commite3e61c1642d3bfc5a514dc96aba36ad9b89406a9 (patch)
tree7de57bf128ac398517c7dc65f33e94e9e4b85feb /Python
parenta1633cd993105aa86fccce05056703248a0c2db7 (diff)
downloadcpython-e3e61c1642d3bfc5a514dc96aba36ad9b89406a9.zip
cpython-e3e61c1642d3bfc5a514dc96aba36ad9b89406a9.tar.gz
cpython-e3e61c1642d3bfc5a514dc96aba36ad9b89406a9.tar.bz2
empty kw dict is ok for builtins
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index a0431aa..d725d35 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2281,6 +2281,11 @@ PyEval_CallObjectWithKeywords(func, arg, kw)
else
INCREF(arg);
+ if (kw != NULL && !is_dictobject(kw)) {
+ err_setstr(TypeError, "keyword list must be a dictionary");
+ return NULL;
+ }
+
if (call = func->ob_type->tp_call)
result = (*call)(func, arg, kw);
else if (is_instancemethodobject(func) || is_funcobject(func))
@@ -2316,7 +2321,7 @@ call_builtin(func, arg, kw)
}
if (flags & METH_KEYWORDS)
return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
- if (kw != NULL) {
+ if (kw != NULL && getmappingsize(kw) != 0) {
err_setstr(TypeError,
"this function takes no keyword arguments");
return NULL;