diff --git a/third_party/python/Modules/_collectionsmodule.c b/third_party/python/Modules/_collectionsmodule.c index 1eb394b34..45fec95cd 100644 --- a/third_party/python/Modules/_collectionsmodule.c +++ b/third_party/python/Modules/_collectionsmodule.c @@ -936,14 +936,10 @@ done: } static PyObject * -deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs, - PyObject *kwnames) +deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs) { Py_ssize_t n=1; - if (!_PyArg_NoStackKeywords("rotate", kwnames)) { - return NULL; - } if (!_PyArg_ParseStack(args, nargs, "|n:rotate", &n)) { return NULL; } @@ -1076,8 +1072,7 @@ deque_len(dequeobject *deque) } static PyObject * -deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs, - PyObject *kwnames) +deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs) { Py_ssize_t i, n, start=0, stop=Py_SIZE(deque); PyObject *v, *item; @@ -1086,9 +1081,6 @@ deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs, size_t start_state = deque->state; int cmp; - if (!_PyArg_NoStackKeywords("index", kwnames)) { - return NULL; - } if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index", &v, _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &stop)) { @@ -1157,17 +1149,13 @@ PyDoc_STRVAR(index_doc, */ static PyObject * -deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs, - PyObject *kwnames) +deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs) { Py_ssize_t index; Py_ssize_t n = Py_SIZE(deque); PyObject *value; PyObject *rv; - if (!_PyArg_NoStackKeywords("insert", kwnames)) { - return NULL; - } if (!_PyArg_ParseStack(args, nargs, "nO:insert", &index, &value)) { return NULL; } diff --git a/third_party/python/Modules/_elementtree.c b/third_party/python/Modules/_elementtree.c index 6e65678de..d5ce7ff0b 100644 --- a/third_party/python/Modules/_elementtree.c +++ b/third_party/python/Modules/_elementtree.c @@ -2806,6 +2806,9 @@ typedef struct { } XMLParserObject; +static PyObject * +_elementtree_XMLParser_doctype(XMLParserObject* self, PyObject** args, + Py_ssize_t nargs); static PyObject * _elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name, PyObject *pubid, PyObject *system); @@ -3222,7 +3225,7 @@ expat_start_doctype_handler(XMLParserObject *self, !(PyCFunction_Check(parser_doctype) && PyCFunction_GET_SELF(parser_doctype) == self_pyobj && PyCFunction_GET_FUNCTION(parser_doctype) == - (PyCFunction) _elementtree_XMLParser_doctype_impl)) { + (PyCFunction) _elementtree_XMLParser_doctype)) { res = _elementtree_XMLParser_doctype_impl(self, doctype_name_obj, pubid_obj, sysid_obj); if (!res) @@ -3808,7 +3811,7 @@ static PyMethodDef element_methods[] = { _ELEMENTTREE_ELEMENT_ITERTEXT_METHODDEF _ELEMENTTREE_ELEMENT_ITERFIND_METHODDEF - {"getiterator", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL, _elementtree_Element_iter__doc__}, + {"getiterator", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL | METH_KEYWORDS, _elementtree_Element_iter__doc__}, _ELEMENTTREE_ELEMENT_GETCHILDREN_METHODDEF _ELEMENTTREE_ELEMENT_ITEMS_METHODDEF diff --git a/third_party/python/Modules/_struct.c b/third_party/python/Modules/_struct.c index 63e6eeded..099027d61 100644 --- a/third_party/python/Modules/_struct.c +++ b/third_party/python/Modules/_struct.c @@ -1870,7 +1870,7 @@ to the format string S.format. See help(struct) for more on format\n\ strings."); static PyObject * -s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs) { PyStructObject *soself; PyObject *result; @@ -1885,9 +1885,6 @@ s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) "pack expected %zd items for packing (got %zd)", soself->s_len, nargs); return NULL; } - if (!_PyArg_NoStackKeywords("pack", kwnames)) { - return NULL; - } /* Allocate a new string */ result = PyBytes_FromStringAndSize((char *)NULL, soself->s_size); @@ -1912,7 +1909,7 @@ offset. Note that the offset is a required argument. See\n\ help(struct) for more on format strings."); static PyObject * -s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs) { PyStructObject *soself; Py_buffer buffer; @@ -1939,9 +1936,6 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames } return NULL; } - if (!_PyArg_NoStackKeywords("pack_into", kwnames)) { - return NULL; - } /* Extract a writable memory buffer from the first argument */ if (!PyArg_Parse(args[0], "w*", &buffer)) @@ -2162,7 +2156,7 @@ pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) if (s_object == NULL) { return NULL; } - result = s_pack((PyObject *)s_object, args + 1, nargs - 1, kwnames); + result = s_pack((PyObject *)s_object, args + 1, nargs - 1); Py_DECREF(s_object); return result; } @@ -2191,7 +2185,7 @@ pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) if (s_object == NULL) { return NULL; } - result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1, kwnames); + result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1); Py_DECREF(s_object); return result; } diff --git a/third_party/python/Objects/call.c b/third_party/python/Objects/call.c index b5a5157b5..bd1d8b4ea 100644 --- a/third_party/python/Objects/call.c +++ b/third_party/python/Objects/call.c @@ -400,7 +400,7 @@ _PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, result = _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, args, nargs, - k, k + 1, nk, 2, + k, k != NULL ? k + 1 : NULL, nk, 2, d, nd, kwdefs, closure, name, qualname); Py_XDECREF(kwtuple); @@ -879,9 +879,10 @@ _PyObject_FastCall_Prepend(PyObject *callable, /* use borrowed references */ args2[0] = obj; - memcpy(&args2[1], - args, - (nargs - 1)* sizeof(PyObject *)); + if (nargs > 1) + { + memcpy(&args2[1], args, (nargs - 1) * sizeof(PyObject *)); + } result = _PyObject_FastCall(callable, args2, nargs); if (args2 != small_stack) {