]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
changes for keyword args to built-in functions and classes
authorGuido van Rossum <guido@python.org>
Wed, 26 Jul 1995 18:07:32 +0000 (18:07 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 26 Jul 1995 18:07:32 +0000 (18:07 +0000)
Objects/classobject.c
Objects/methodobject.c

index 9870b6e77e969fe7c3aa4e2ac80c9dcaa0b39b30..d4a873f6fe227e22416478b7c8fd7312174cb1f1 100644 (file)
@@ -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);
index d9daf2349d35ae50916eefc572c2e4b142ba4580..1444924b69dff1d316fd95a444a80a7b27ef792a 100644 (file)
@@ -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) */