[Python-checkins] r52103 - in python/branches/release24-maint: Misc/NEWS Objects/funcobject.c

andrew.kuchling python-checkins at python.org
Tue Oct 3 20:25:20 CEST 2006


Author: andrew.kuchling
Date: Tue Oct  3 20:25:19 2006
New Revision: 52103

Modified:
   python/branches/release24-maint/Misc/NEWS
   python/branches/release24-maint/Objects/funcobject.c
Log:
[Backport rev. 42545 by georg.brandl]

Make staticmethod and classmethod complain about keyword args.


Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Tue Oct  3 20:25:19 2006
@@ -16,6 +16,9 @@
   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.

Modified: python/branches/release24-maint/Objects/funcobject.c
==============================================================================
--- python/branches/release24-maint/Objects/funcobject.c	(original)
+++ python/branches/release24-maint/Objects/funcobject.c	Tue Oct  3 20:25:19 2006
@@ -684,6 +684,8 @@
 
 	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 @@
 
 	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;


More information about the Python-checkins mailing list