mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using "boring" positional arguments. Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain consistent with the clinic code.
This commit is contained in:
parent
093119e4eb
commit
0c4a828cad
19 changed files with 357 additions and 165 deletions
|
@ -184,22 +184,26 @@ PyDoc_STRVAR(bytes_strip__doc__,
|
|||
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
|
||||
|
||||
#define BYTES_STRIP_METHODDEF \
|
||||
{"strip", (PyCFunction)bytes_strip, METH_VARARGS, bytes_strip__doc__},
|
||||
{"strip", (PyCFunction)bytes_strip, METH_FASTCALL, bytes_strip__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
|
||||
|
||||
static PyObject *
|
||||
bytes_strip(PyBytesObject *self, PyObject *args)
|
||||
bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *bytes = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "strip",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "strip",
|
||||
0, 1,
|
||||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_strip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -215,22 +219,26 @@ PyDoc_STRVAR(bytes_lstrip__doc__,
|
|||
"If the argument is omitted or None, strip leading ASCII whitespace.");
|
||||
|
||||
#define BYTES_LSTRIP_METHODDEF \
|
||||
{"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, bytes_lstrip__doc__},
|
||||
{"lstrip", (PyCFunction)bytes_lstrip, METH_FASTCALL, bytes_lstrip__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
|
||||
|
||||
static PyObject *
|
||||
bytes_lstrip(PyBytesObject *self, PyObject *args)
|
||||
bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *bytes = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "lstrip",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "lstrip",
|
||||
0, 1,
|
||||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_lstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -246,22 +254,26 @@ PyDoc_STRVAR(bytes_rstrip__doc__,
|
|||
"If the argument is omitted or None, strip trailing ASCII whitespace.");
|
||||
|
||||
#define BYTES_RSTRIP_METHODDEF \
|
||||
{"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, bytes_rstrip__doc__},
|
||||
{"rstrip", (PyCFunction)bytes_rstrip, METH_FASTCALL, bytes_rstrip__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
|
||||
|
||||
static PyObject *
|
||||
bytes_rstrip(PyBytesObject *self, PyObject *args)
|
||||
bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *bytes = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "rstrip",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "rstrip",
|
||||
0, 1,
|
||||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_rstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -507,4 +519,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=2b8d3cff7e11045e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=2504c1225108d348 input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue