Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.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 | 30b97c1bb12d |
| children | 1af7f719ed28 |
line wrap: on
line diff
--- a/Modules/arraymodule.c Thu Aug 25 22:40:16 2005 +0000 +++ b/Modules/arraymodule.c Fri Aug 26 06:42:30 2005 +0000 @@ -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;
