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

@ -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;
}