[Python-checkins] python/dist/src/Modules arraymodule.c, 2.98, 2.99 itertoolsmodule.c, 1.40, 1.41 operator.c, 2.30, 2.31 _randommodule.c, 1.7, 1.8 zipimport.c, 1.18, 1.19 collectionsmodule.c, 1.38, 1.39
birkenfeld@users.sourceforge.net
birkenfeld at users.sourceforge.net
Fri Aug 26 08:42:41 CEST 2005
- Previous message: [Python-checkins] python/dist/src/Objects rangeobject.c, 2.54, 2.55 setobject.c, 1.55, 1.56 bufferobject.c, 2.26, 2.27 sliceobject.c, 2.22, 2.23
- Next message: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.86, 1.1193.2.87
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18370/Modules
Modified Files:
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 bug #1119418)
Index: arraymodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v
retrieving revision 2.98
retrieving revision 2.99
diff -u -d -r2.98 -r2.99
--- arraymodule.c 16 Dec 2004 16:23:39 -0000 2.98
+++ arraymodule.c 26 Aug 2005 06:42:30 -0000 2.99
@@ -1799,18 +1799,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.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- itertoolsmodule.c 5 Dec 2004 09:25:51 -0000 1.40
+++ itertoolsmodule.c 26 Aug 2005 06:42:30 -0000 1.41
@@ -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;
+
if (!PyArg_UnpackTuple(args, "islice", 2, 4, &seq, &a1, &a2, &a3))
return NULL;
@@ -1236,6 +1248,9 @@
PyObject *it;
starmapobject *lz;
+ if (!_PyArg_NoKeywords("starmap()", kwds))
+ return NULL;
+
if (!PyArg_UnpackTuple(args, "starmap", 2, 2, &func, &seq))
return NULL;
@@ -1365,6 +1380,9 @@
imapobject *lz;
int numargs, i;
+ if (!_PyArg_NoKeywords("imap()", kwds))
+ return NULL;
+
numargs = PyTuple_Size(args);
if (numargs < 2) {
PyErr_SetString(PyExc_TypeError,
@@ -1544,6 +1562,9 @@
int i;
PyObject *ittuple;
+ if (!_PyArg_NoKeywords("chain()", kwds))
+ return NULL;
+
/* obtain iterators */
assert(PyTuple_Check(args));
ittuple = PyTuple_New(tuplesize);
@@ -1684,6 +1705,9 @@
PyObject *it;
ifilterobject *lz;
+ if (!_PyArg_NoKeywords("ifilter()", kwds))
+ return NULL;
+
if (!PyArg_UnpackTuple(args, "ifilter", 2, 2, &func, &seq))
return NULL;
@@ -1825,6 +1849,9 @@
PyObject *it;
ifilterfalseobject *lz;
+ if (!_PyArg_NoKeywords("ifilterfalse()", kwds))
+ return NULL;
+
if (!PyArg_UnpackTuple(args, "ifilterfalse", 2, 2, &func, &seq))
return NULL;
@@ -1964,6 +1991,9 @@
countobject *lz;
long cnt = 0;
+ if (!_PyArg_NoKeywords("count()", kwds))
+ return NULL;
+
if (!PyArg_ParseTuple(args, "|l:count", &cnt))
return NULL;
@@ -2060,6 +2090,9 @@
PyObject *result;
int tuplesize = PySequence_Length(args);
+ if (!_PyArg_NoKeywords("izip()", kwds))
+ return NULL;
+
/* args must be a tuple */
assert(PyTuple_Check(args));
@@ -2240,6 +2273,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.30
retrieving revision 2.31
diff -u -d -r2.30 -r2.31
--- operator.c 9 Mar 2005 16:38:46 -0000 2.30
+++ operator.c 26 Aug 2005 06:42:30 -0000 2.31
@@ -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))
Index: _randommodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_randommodule.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- _randommodule.c 5 Oct 2003 09:09:15 -0000 1.7
+++ _randommodule.c 26 Aug 2005 06:42:30 -0000 1.8
@@ -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.19
diff -u -d -r1.18 -r1.19
--- zipimport.c 10 Nov 2004 13:08:35 -0000 1.18
+++ zipimport.c 26 Aug 2005 06:42:30 -0000 1.19
@@ -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.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- collectionsmodule.c 19 Mar 2005 00:00:48 -0000 1.38
+++ collectionsmodule.c 26 Aug 2005 06:42:30 -0000 1.39
@@ -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)
- Previous message: [Python-checkins] python/dist/src/Objects rangeobject.c, 2.54, 2.55 setobject.c, 1.55, 1.56 bufferobject.c, 2.26, 2.27 sliceobject.c, 2.22, 2.23
- Next message: [Python-checkins] python/dist/src/Misc NEWS, 1.1193.2.86, 1.1193.2.87
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list