]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Backport rev. 42545 by georg.brandl]
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 18:25:19 +0000 (18:25 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 18:25:19 +0000 (18:25 +0000)
Make staticmethod and classmethod complain about keyword args.

Misc/NEWS
Objects/funcobject.c

index bc48b007b2d6f2f5688e47a9a1b076a9f12e85ff..2a6145c72c0c6591f9897d5891008ba3ccbf1ef0 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -16,6 +16,9 @@ Core and builtins
   keyword arguments any more (previously they accepted them, but didn't
   use them).
 
+- staticmethod() and classmethod() also now complain about keyword args
+  instead of silently ignoring them.
+
 - Bug #1331062: Fix error in UTF-7 codec.
 
 - Bug #1365916: Fix an int/long mismatch in the sorted() built-in.
index c0c91c95d17d8c625886f23cd2fc66eea168aad6..36c1ba86f6c508fb7dae964de4e3bc9f93f6f1c9 100644 (file)
@@ -684,6 +684,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);
@@ -840,6 +842,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;