diff Modules/operator.c @ 35449:1fdfd0130e28 legacy-trunk

Disallow keyword arguments for type constructors that don't use them. (fixes bug #1119418)
author Georg Brandl <georg@python.org>
date Fri, 26 Aug 2005 06:42:30 +0000
parents ddc2276c247e
children e44a833eca43
line wrap: on
line diff
--- a/Modules/operator.c	Thu Aug 25 22:40:16 2005 +0000
+++ b/Modules/operator.c	Fri Aug 26 06:42:30 2005 +0000
@@ -269,6 +269,9 @@
 	PyObject *item;
 	int nitems;
 
+	if (!_PyArg_NoKeywords("itemgetter()", kwds))
+		return NULL;
+
 	nitems = PyTuple_GET_SIZE(args);
 	if (nitems <= 1) {
 		if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &item))
@@ -405,6 +408,9 @@
 	PyObject *attr;
 	int nattrs;
 
+	if (!_PyArg_NoKeywords("attrgetter()", kwds))
+		return NULL;
+
 	nattrs = PyTuple_GET_SIZE(args);
 	if (nattrs <= 1) {
 		if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &attr))