mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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.
This commit is contained in:
parent
aa0aa0492c
commit
6969eaf468
76 changed files with 616 additions and 1916 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue