From a83f270a4ba3a8e3fcc38fa1bdf7f62dd723cfb8 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 26 Jul 1995 18:07:32 +0000 Subject: changes for keyword args to built-in functions and classes --- Objects/classobject.c | 11 ++++++----- Objects/methodobject.c | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Objects/classobject.c b/Objects/classobject.c index 9870b6e..d4a873f6 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -279,9 +279,10 @@ addaccess(class, inst) } object * -newinstanceobject(class, arg) +newinstanceobject(class, arg, kw) object *class; object *arg; + object *kw; { register instanceobject *inst; object *init; @@ -303,16 +304,16 @@ newinstanceobject(class, arg) init = instance_getattr1(inst, "__init__"); if (init == NULL) { err_clear(); - if (arg != NULL && !(is_tupleobject(arg) && - gettuplesize(arg) == 0)) { + if (arg != NULL && (!is_tupleobject(arg) || + gettuplesize(arg) != 0) || kw != NULL) { err_setstr(TypeError, - "this classobject() takes no arguments"); + "this constructor takes no arguments"); DECREF(inst); inst = NULL; } } else { - object *res = call_object(init, arg); + object *res = PyEval_CallObjectWithKeywords(init, arg, kw); DECREF(init); if (res == NULL) { DECREF(inst); diff --git a/Objects/methodobject.c b/Objects/methodobject.c index d9daf23..1444924 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -71,14 +71,14 @@ getself(op) } int -getvarargs(op) +getflags(op) object *op; { if (!is_methodobject(op)) { err_badcall(); return -1; } - return ((methodobject *)op) -> m_ml -> ml_flags & METH_VARARGS; + return ((methodobject *)op) -> m_ml -> ml_flags; } /* Methods (the standard built-in methods, that is) */ -- cgit v0.12