Make staticmethod and classmethod complain about keyword args.
authorGeorg Brandl <georg@python.org>
Tue, 21 Feb 2006 22:13:44 +0000 (22:13 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 21 Feb 2006 22:13:44 +0000 (22:13 +0000)
Objects/funcobject.c

index fe34a11b54314449df76181b745888698f6725e3..6c683499f375084b98fee23ea1cd1e38c1bd53fe 100644 (file)
@@ -686,6 +686,8 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
 
        if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable))
                return -1;
+       if (!_PyArg_NoKeywords("classmethod", kwds))
+               return -1;
        if (!PyCallable_Check(callable)) {
                PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
                     callable->ob_type->tp_name);
@@ -842,6 +844,8 @@ sm_init(PyObject *self, PyObject *args, PyObject *kwds)
 
        if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable))
                return -1;
+       if (!_PyArg_NoKeywords("staticmethod", kwds))
+               return -1;
        Py_INCREF(callable);
        sm->sm_callable = callable;
        return 0;