comparison 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
comparison
equal deleted inserted replaced
35447:0999290c6758 35449:1fdfd0130e28
1797 array_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 1797 array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
1798 { 1798 {
1799 char c; 1799 char c;
1800 PyObject *initial = NULL, *it = NULL; 1800 PyObject *initial = NULL, *it = NULL;
1801 struct arraydescr *descr; 1801 struct arraydescr *descr;
1802 1802
1803 if (kwds != NULL) { 1803 if (!_PyArg_NoKeywords("array.array()", kwds))
1804 int i = PyObject_Length(kwds); 1804 return NULL;
1805 if (i < 0)
1806 return NULL;
1807 else if (i > 0) {
1808 PyErr_SetString(PyExc_TypeError,
1809 "array.array constructor takes "
1810 "no keyword arguments");
1811 return NULL;
1812 }
1813 }
1814 1805
1815 if (!PyArg_ParseTuple(args, "c|O:array", &c, &initial)) 1806 if (!PyArg_ParseTuple(args, "c|O:array", &c, &initial))
1816 return NULL; 1807 return NULL;
1817 1808
1818 if (!(initial == NULL || PyList_Check(initial) 1809 if (!(initial == NULL || PyList_Check(initial)