[Python-checkins] python/dist/src/Modules arraymodule.c, 2.97, 2.97.2.1 itertoolsmodule.c, 1.39, 1.39.2.1 operator.c, 2.29, 2.29.4.1 _randommodule.c, 1.7, 1.7.4.1 zipimport.c, 1.18, 1.18.2.1 collectionsmodule.c, 1.36, 1.36.2.1
birkenfeld@users.sourceforge.net
birkenfeld at users.sourceforge.net
Fri Aug 26 08:43:28 CEST 2005
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18531/Modules
Modified Files:
Tag: release24-maint
arraymodule.c itertoolsmodule.c operator.c _randommodule.c
zipimport.c collectionsmodule.c
Log Message:
Disallow keyword arguments for type constructors that don't use them
(fixes #1119418).
Index: arraymodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v
retrieving revision 2.97
retrieving revision 2.97.2.1
diff -u -d -r2.97 -r2.97.2.1
--- arraymodule.c 29 Aug 2004 07:50:42 -0000 2.97
+++ arraymodule.c 26 Aug 2005 06:43:16 -0000 2.97.2.1
@@ -1774,18 +1774,9 @@
char c;
PyObject *initial = NULL, *it = NULL;
struct arraydescr *descr;
-
- if (kwds != NULL) {
- int i = PyObject_Length(kwds);
- if (i < 0)
- return NULL;
- else if (i > 0) {
- PyErr_SetString(PyExc_TypeError,
- "array.array constructor takes "
- "no keyword arguments");
- return NULL;
- }
- }
+
+ if (!_PyArg_NoKeywords("array.array()", kwds))
+ return NULL;
if (!PyArg_ParseTuple(args, "c|O:array", &c, &initial))
return NULL;
Index: itertoolsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v
retrieving revision 1.39
retrieving revision 1.39.2.1
diff -u -d -r1.39 -r1.39.2.1
--- itertoolsmodule.c 17 Oct 2004 19:36:57 -0000 1.39
+++ itertoolsmodule.c 26 Aug 2005 06:43:16 -0000 1.39.2.1
@@ -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;
Index: operator.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v
retrieving revision 2.29
retrieving revision 2.29.4.1
diff -u -d -r2.29 -r2.29.4.1
--- operator.c 4 Dec 2003 22:17:49 -0000 2.29
+++ operator.c 26 Aug 2005 06:43:16 -0000 2.29.4.1
@@ -267,6 +267,9 @@
itemgetterobject *ig;
PyObject *item;
+ if (!_PyArg_NoKeywords("itemgetter()", kdws))
+ return NULL;
+
if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &item))
return NULL;
@@ -374,6 +377,9 @@
attrgetterobject *ag;
PyObject *attr;
+ if (!_PyArg_NoKeywords("attrgetter()", kwds))
+ return NULL;
+
if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &attr))
return NULL;
Index: _randommodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_randommodule.c,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -u -d -r1.7 -r1.7.4.1
--- _randommodule.c 5 Oct 2003 09:09:15 -0000 1.7
+++ _randommodule.c 26 Aug 2005 06:43:16 -0000 1.7.4.1
@@ -481,6 +481,9 @@
RandomObject *self;
PyObject *tmp;
+ if (!_PyArg_NoKeywords("Random()", kwds))
+ return NULL;
+
self = (RandomObject *)type->tp_alloc(type, 0);
if (self == NULL)
return NULL;
Index: zipimport.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/zipimport.c,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -d -r1.18 -r1.18.2.1
--- zipimport.c 10 Nov 2004 13:08:35 -0000 1.18
+++ zipimport.c 26 Aug 2005 06:43:16 -0000 1.18.2.1
@@ -65,6 +65,9 @@
char *path, *p, *prefix, buf[MAXPATHLEN+2];
int len;
+ if (!_PyArg_NoKeywords("zipimporter()", kwds))
+ return -1;
+
if (!PyArg_ParseTuple(args, "s:zipimporter",
&path))
return -1;
Index: collectionsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v
retrieving revision 1.36
retrieving revision 1.36.2.1
diff -u -d -r1.36 -r1.36.2.1
--- collectionsmodule.c 9 Nov 2004 07:27:34 -0000 1.36
+++ collectionsmodule.c 26 Aug 2005 06:43:16 -0000 1.36.2.1
@@ -95,6 +95,9 @@
dequeobject *deque;
block *b;
+ if (!_PyArg_NoKeywords("deque()", kwds))
+ return NULL;
+
/* create dequeobject structure */
deque = (dequeobject *)type->tp_alloc(type, 0);
if (deque == NULL)
More information about the Python-checkins
mailing list