summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-08-26 06:42:30 (GMT)
committerGeorg Brandl <georg@python.org>2005-08-26 06:42:30 (GMT)
commit02c42871cf73365dc5b6915cac2b017b2b90c81f (patch)
treea85d3fb2fc3682c2a149d213f5cf9a378868abea /Modules/arraymodule.c
parentbd77da6dab9d41ef246febf54c7928ce4496dd49 (diff)
downloadcpython-02c42871cf73365dc5b6915cac2b017b2b90c81f.zip
cpython-02c42871cf73365dc5b6915cac2b017b2b90c81f.tar.gz
cpython-02c42871cf73365dc5b6915cac2b017b2b90c81f.tar.bz2
Disallow keyword arguments for type constructors that don't use them.
(fixes bug #1119418)
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 6430333..3c60350 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1799,18 +1799,9 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
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;