summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-07-18 14:51:37 (GMT)
committerGuido van Rossum <guido@python.org>1995-07-18 14:51:37 (GMT)
commit681d79aaf397850778608f35585d091fa7fe370a (patch)
tree3d45bd9b84777931bba732abd1dbba484e2a64c1 /Python/bltinmodule.c
parent11a3f0c2bca1a8fdea396b989559f25fbc6fe65e (diff)
downloadcpython-681d79aaf397850778608f35585d091fa7fe370a.zip
cpython-681d79aaf397850778608f35585d091fa7fe370a.tar.gz
cpython-681d79aaf397850778608f35585d091fa7fe370a.tar.bz2
keyword arguments and faster calls
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 5103622..0be0373 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -80,15 +80,20 @@ builtin_apply(self, args)
object *self;
object *args;
{
- object *func, *alist;
+ object *func, *alist, *kwdict = NULL;
- if (!newgetargs(args, "OO:apply", &func, &alist))
+ if (!newgetargs(args, "O|OO:apply", &func, &alist, &kwdict))
return NULL;
- if (!is_tupleobject(alist)) {
+ if (alist != NULL && !is_tupleobject(alist)) {
err_setstr(TypeError, "apply() 2nd argument must be tuple");
return NULL;
}
- return call_object(func, alist);
+ if (kwdict != NULL && !is_dictobject(kwdict)) {
+ err_setstr(TypeError,
+ "apply() 3rd argument must be dictionary");
+ return NULL;
+ }
+ return PyEval_CallObjectWithKeywords(func, alist, kwdict);
}
static object *
@@ -373,8 +378,7 @@ builtin_eval(self, args)
return NULL;
}
if (is_codeobject(cmd))
- return eval_code((codeobject *) cmd, globals, locals,
- (object *)NULL, (object *)NULL);
+ return eval_code((codeobject *) cmd, globals, locals);
if (!is_stringobject(cmd)) {
err_setstr(TypeError,
"eval() argument 1 must be string or code object");