diff options
author | Georg Brandl <georg@python.org> | 2005-08-26 06:42:30 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-08-26 06:42:30 (GMT) |
commit | 02c42871cf73365dc5b6915cac2b017b2b90c81f (patch) | |
tree | a85d3fb2fc3682c2a149d213f5cf9a378868abea /Objects | |
parent | bd77da6dab9d41ef246febf54c7928ce4496dd49 (diff) | |
download | cpython-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 'Objects')
-rw-r--r-- | Objects/bufferobject.c | 5 | ||||
-rw-r--r-- | Objects/rangeobject.c | 3 | ||||
-rw-r--r-- | Objects/setobject.c | 6 | ||||
-rw-r--r-- | Objects/sliceobject.c | 3 |
4 files changed, 16 insertions, 1 deletions
diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c index 674d2b5..da8d9fc 100644 --- a/Objects/bufferobject.c +++ b/Objects/bufferobject.c @@ -192,7 +192,10 @@ buffer_new(PyTypeObject *type, PyObject *args, PyObject *kw) int offset = 0; int size = Py_END_OF_BUFFER; - if ( !PyArg_ParseTuple(args, "O|ii:buffer", &ob, &offset, &size) ) + if (!_PyArg_NoKeywords("buffer()", kw)) + return NULL; + + if (!PyArg_ParseTuple(args, "O|ii:buffer", &ob, &offset, &size)) return NULL; return PyBuffer_FromObject(ob, offset, size); } diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 2f5d164..8b5650a 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -45,6 +45,9 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw) long ilow = 0, ihigh = 0, istep = 1; long n; + if (!_PyArg_NoKeywords("xrange()", kw)) + return NULL; + if (PyTuple_Size(args) <= 1) { if (!PyArg_ParseTuple(args, "l;xrange() requires 1-3 int arguments", diff --git a/Objects/setobject.c b/Objects/setobject.c index 8787347..dbfa79c 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -935,6 +935,9 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyObject *iterable = NULL, *result; + if (!_PyArg_NoKeywords("frozenset()", kwds)) + return NULL; + if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable)) return NULL; @@ -976,6 +979,9 @@ PySet_Fini(void) static PyObject * set_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { + if (!_PyArg_NoKeywords("set()", kwds)) + return NULL; + return make_new_set(type, NULL); } diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index c37af2b..f5ed898 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -174,6 +174,9 @@ slice_new(PyTypeObject *type, PyObject *args, PyObject *kw) start = stop = step = NULL; + if (!_PyArg_NoKeywords("slice()", kw)) + return NULL; + if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) return NULL; |