diff Modules/itertoolsmodule.c @ 35450:97c97194e64b 2.4

Disallow keyword arguments for type constructors that don't use them (fixes #1119418).
author Georg Brandl <georg@python.org>
date Fri, 26 Aug 2005 06:43:16 +0000
parents c66e6c9ffc2d
children 6fb46e87d5f9
line wrap: on
line diff
--- a/Modules/itertoolsmodule.c	Thu Aug 25 22:40:21 2005 +0000
+++ b/Modules/itertoolsmodule.c	Fri Aug 26 06:43:16 2005 +0000
@@ -618,6 +618,9 @@
 	PyObject *saved;
 	cycleobject *lz;
 
+	if (!_PyArg_NoKeywords("cycle()", kwds))
+		return NULL;
+
 	if (!PyArg_UnpackTuple(args, "cycle", 1, 1, &iterable))
 		return NULL;
 
@@ -765,6 +768,9 @@
 	PyObject *it;
 	dropwhileobject *lz;
 
+	if (!_PyArg_NoKeywords("dropwhile()", kwds))
+		return NULL;
+
 	if (!PyArg_UnpackTuple(args, "dropwhile", 2, 2, &func, &seq))
 		return NULL;
 
@@ -906,6 +912,9 @@
 	PyObject *it;
 	takewhileobject *lz;
 
+	if (!_PyArg_NoKeywords("takewhile()", kwds))
+		return NULL;
+
 	if (!PyArg_UnpackTuple(args, "takewhile", 2, 2, &func, &seq))
 		return NULL;
 
@@ -1048,6 +1057,9 @@
 	int numargs;
 	isliceobject *lz;
 
+	if (!_PyArg_NoKeywords("islice()", kwds))
+		return NULL;
+
 	numargs = PyTuple_Size(args);
 	if (!PyArg_ParseTuple(args, "OO|Ol:islice", &seq, &a1, &a2, &step))
 		return NULL;
@@ -1234,6 +1246,9 @@
 	PyObject *it;
 	starmapobject *lz;
 
+	if (!_PyArg_NoKeywords("starmap()", kwds))
+		return NULL;
+
 	if (!PyArg_UnpackTuple(args, "starmap", 2, 2, &func, &seq))
 		return NULL;
 
@@ -1363,6 +1378,9 @@
 	imapobject *lz;
 	int numargs, i;
 
+	if (!_PyArg_NoKeywords("imap()", kwds))
+		return NULL;
+
 	numargs = PyTuple_Size(args);
 	if (numargs < 2) {
 		PyErr_SetString(PyExc_TypeError,
@@ -1542,6 +1560,9 @@
 	int i;
 	PyObject *ittuple;
 
+	if (!_PyArg_NoKeywords("chain()", kwds))
+		return NULL;
+
 	/* obtain iterators */
 	assert(PyTuple_Check(args));
 	ittuple = PyTuple_New(tuplesize);
@@ -1682,6 +1703,9 @@
 	PyObject *it;
 	ifilterobject *lz;
 
+	if (!_PyArg_NoKeywords("ifilter()", kwds))
+		return NULL;
+
 	if (!PyArg_UnpackTuple(args, "ifilter", 2, 2, &func, &seq))
 		return NULL;
 
@@ -1823,6 +1847,9 @@
 	PyObject *it;
 	ifilterfalseobject *lz;
 
+	if (!_PyArg_NoKeywords("ifilterfalse()", kwds))
+		return NULL;
+
 	if (!PyArg_UnpackTuple(args, "ifilterfalse", 2, 2, &func, &seq))
 		return NULL;
 
@@ -1962,6 +1989,9 @@
 	countobject *lz;
 	long cnt = 0;
 
+	if (!_PyArg_NoKeywords("count()", kwds))
+		return NULL;
+
 	if (!PyArg_ParseTuple(args, "|l:count", &cnt))
 		return NULL;
 
@@ -2058,6 +2088,9 @@
 	PyObject *result;
 	int tuplesize = PySequence_Length(args);
 
+	if (!_PyArg_NoKeywords("izip()", kwds))
+		return NULL;
+
 	/* args must be a tuple */
 	assert(PyTuple_Check(args));
 
@@ -2238,6 +2271,9 @@
 	PyObject *element;
 	long cnt = -1;
 
+	if (!_PyArg_NoKeywords("repeat()", kwds))
+		return NULL;
+
 	if (!PyArg_ParseTuple(args, "O|l:repeat", &element, &cnt))
 		return NULL;