diff Modules/arraymodule.c @ 35450:97c97194e64b 2.4

Disallow keyword arguments for type constructors that don't use them (fixes #1119418).
author Georg Brandl <georg@python.org>
date Fri, 26 Aug 2005 06:43:16 +0000
parents 0b181bf230c9
children accfb156f9cc
line wrap: on
line diff
--- a/Modules/arraymodule.c	Thu Aug 25 22:40:21 2005 +0000
+++ b/Modules/arraymodule.c	Fri Aug 26 06:43:16 2005 +0000
@@ -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;