mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Python 3.7 METH_FASTCALL backport (#406)
This commit is contained in:
parent
fec396037a
commit
83b743cf96
103 changed files with 2949 additions and 3356 deletions
14
third_party/python/Modules/_struct.c
vendored
14
third_party/python/Modules/_struct.c
vendored
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue