From 6969eaf4682beb01bc95eeb14f5ce6c01312e297 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 3 Jul 2017 21:20:15 +0300 Subject: bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955) the bare METH_FASTCALL be used for functions with positional-only parameters. --- Modules/_struct.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'Modules/_struct.c') diff --git a/Modules/_struct.c b/Modules/_struct.c index b4febf7750..b5fbc43564 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1817,15 +1817,12 @@ 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; /* Validate arguments. */ - if (!_PyArg_NoStackKeywords("pack", kwnames)) { - return NULL; - } soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); @@ -1859,16 +1856,13 @@ 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; Py_ssize_t offset; /* Validate arguments. +1 is for the first arg as buffer. */ - if (!_PyArg_NoStackKeywords("pack_into", kwnames)) { - return NULL; - } soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); @@ -2126,15 +2120,11 @@ Return a bytes object containing the values v1, v2, ... packed according\n\ to the format string. See help(struct) for more on format strings."); static PyObject * -pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +pack(PyObject *self, PyObject **args, Py_ssize_t nargs) { PyObject *s_object = NULL; PyObject *format, *result; - if (!_PyArg_NoStackKeywords("pack", kwnames)) { - return NULL; - } - if (nargs == 0) { PyErr_SetString(PyExc_TypeError, "missing format argument"); return NULL; @@ -2144,7 +2134,7 @@ pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) if (!cache_struct_converter(format, &s_object)) { return NULL; } - result = s_pack(s_object, args + 1, nargs - 1, kwnames); + result = s_pack(s_object, args + 1, nargs - 1); Py_DECREF(s_object); return result; } @@ -2158,15 +2148,11 @@ that the offset is a required argument. See help(struct) for more\n\ on format strings."); static PyObject * -pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs) { PyObject *s_object = NULL; PyObject *format, *result; - if (!_PyArg_NoStackKeywords("pack_into", kwnames)) { - return NULL; - } - if (nargs == 0) { PyErr_SetString(PyExc_TypeError, "missing format argument"); return NULL; @@ -2176,7 +2162,7 @@ pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) if (!cache_struct_converter(format, &s_object)) { return NULL; } - result = s_pack_into(s_object, args + 1, nargs - 1, kwnames); + result = s_pack_into(s_object, args + 1, nargs - 1); Py_DECREF(s_object); return result; } -- cgit v1.2.1