summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs/clinic
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-01-11 16:01:42 (GMT)
committerGitHub <noreply@github.com>2019-01-11 16:01:42 (GMT)
commit2a39d251f07d4c620e3b9a1848e3d1eb3067be64 (patch)
tree23c1e8e63e57945fab6127d31800b7578795e14b /Modules/cjkcodecs/clinic
parent4fa9591025b6a098f3d6402e5413ee6740ede6c5 (diff)
downloadcpython-2a39d251f07d4c620e3b9a1848e3d1eb3067be64.zip
cpython-2a39d251f07d4c620e3b9a1848e3d1eb3067be64.tar.gz
cpython-2a39d251f07d4c620e3b9a1848e3d1eb3067be64.tar.bz2
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.
Diffstat (limited to 'Modules/cjkcodecs/clinic')
-rw-r--r--Modules/cjkcodecs/clinic/multibytecodec.c.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h
index 871bf33..c62a641 100644
--- a/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -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]*/