mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)
Use _PyArg_CheckPositional() and inlined code instead of PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters are positional and use the "object" converter.
This commit is contained in:
parent
4fa9591025
commit
2a39d251f0
30 changed files with 561 additions and 408 deletions
|
@ -296,11 +296,14 @@ _multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, Py
|
|||
PyObject *return_value = NULL;
|
||||
PyObject *sizeobj = Py_None;
|
||||
|
||||
if (!_PyArg_UnpackStack(args, nargs, "read",
|
||||
0, 1,
|
||||
&sizeobj)) {
|
||||
if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 1) {
|
||||
goto skip_optional;
|
||||
}
|
||||
sizeobj = args[0];
|
||||
skip_optional:
|
||||
return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj);
|
||||
|
||||
exit:
|
||||
|
@ -325,11 +328,14 @@ _multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self
|
|||
PyObject *return_value = NULL;
|
||||
PyObject *sizeobj = Py_None;
|
||||
|
||||
if (!_PyArg_UnpackStack(args, nargs, "readline",
|
||||
0, 1,
|
||||
&sizeobj)) {
|
||||
if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 1) {
|
||||
goto skip_optional;
|
||||
}
|
||||
sizeobj = args[0];
|
||||
skip_optional:
|
||||
return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj);
|
||||
|
||||
exit:
|
||||
|
@ -354,11 +360,14 @@ _multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *sel
|
|||
PyObject *return_value = NULL;
|
||||
PyObject *sizehintobj = Py_None;
|
||||
|
||||
if (!_PyArg_UnpackStack(args, nargs, "readlines",
|
||||
0, 1,
|
||||
&sizehintobj)) {
|
||||
if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 1) {
|
||||
goto skip_optional;
|
||||
}
|
||||
sizehintobj = args[0];
|
||||
skip_optional:
|
||||
return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj);
|
||||
|
||||
exit:
|
||||
|
@ -422,4 +431,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
|
|||
|
||||
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
|
||||
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
|
||||
/*[clinic end generated code: output=2ed7030b28a79029 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=bcd6311010557faf input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue