Revert "Backport METH_FASTCALL from Python 3.7 (#328)"

This reverts commit cf73bbd678.
This commit is contained in:
Justine Tunney 2022-05-12 06:49:54 -07:00
parent e7611a8476
commit 2ea1dc405c
102 changed files with 3299 additions and 2894 deletions

View file

@ -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)
s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyStructObject *soself;
PyObject *result;
@ -1885,6 +1885,9 @@ s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs)
"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);
@ -1909,7 +1912,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)
s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyStructObject *soself;
Py_buffer buffer;
@ -1936,6 +1939,9 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs)
}
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))
@ -2156,7 +2162,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);
result = s_pack((PyObject *)s_object, args + 1, nargs - 1, kwnames);
Py_DECREF(s_object);
return result;
}
@ -2185,7 +2191,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);
result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1, kwnames);
Py_DECREF(s_object);
return result;
}