Backport METH_FASTCALL from Python 3.7 (#328)

This commit is contained in:
Gautham 2022-05-12 14:57:16 +05:30 committed by GitHub
parent 70c97f598b
commit cf73bbd678
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
102 changed files with 2896 additions and 3301 deletions

View file

@ -85,7 +85,7 @@ PyDoc_STRVAR(Struct_unpack_from__doc__,
"See help(struct) for more on format strings.");
#define STRUCT_UNPACK_FROM_METHODDEF \
{"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL, Struct_unpack_from__doc__},
{"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL|METH_KEYWORDS, Struct_unpack_from__doc__},
static PyObject *
Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer,
@ -173,7 +173,7 @@ static PyObject *
unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr);
static PyObject *
unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
unpack(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *format;
@ -184,10 +184,6 @@ unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
&format, &inputstr)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("unpack", kwnames)) {
goto exit;
}
return_value = unpack_impl(module, format, inputstr);
exit:
@ -205,7 +201,7 @@ PyDoc_STRVAR(unpack_from__doc__,
"See help(struct) for more on format strings.");
#define UNPACK_FROM_METHODDEF \
{"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL, unpack_from__doc__},
{"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL|METH_KEYWORDS, unpack_from__doc__},
static PyObject *
unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer,
@ -254,7 +250,7 @@ static PyObject *
iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer);
static PyObject *
iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *format;
@ -265,13 +261,9 @@ iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam
&format, &buffer)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("iter_unpack", kwnames)) {
goto exit;
}
return_value = iter_unpack_impl(module, format, buffer);
exit:
return return_value;
}
/*[clinic end generated code: output=db8152ad222fa3d0 input=a9049054013a1b77]*/
/*[clinic end generated code: output=c891fcba70dba650 input=a9049054013a1b77]*/