diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-01-11 16:01:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 16:01:42 (GMT) |
commit | 2a39d251f07d4c620e3b9a1848e3d1eb3067be64 (patch) | |
tree | 23c1e8e63e57945fab6127d31800b7578795e14b /Modules/_io/clinic/bufferedio.c.h | |
parent | 4fa9591025b6a098f3d6402e5413ee6740ede6c5 (diff) | |
download | cpython-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/_io/clinic/bufferedio.c.h')
-rw-r--r-- | Modules/_io/clinic/bufferedio.c.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h index 6345b9e..60a6dac 100644 --- a/Modules/_io/clinic/bufferedio.c.h +++ b/Modules/_io/clinic/bufferedio.c.h @@ -389,11 +389,14 @@ _io__Buffered_truncate(buffered *self, PyObject *const *args, Py_ssize_t nargs) PyObject *return_value = NULL; PyObject *pos = Py_None; - if (!_PyArg_UnpackStack(args, nargs, "truncate", - 0, 1, - &pos)) { + if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) { goto exit; } + if (nargs < 1) { + goto skip_optional; + } + pos = args[0]; +skip_optional: return_value = _io__Buffered_truncate_impl(self, pos); exit: @@ -591,4 +594,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=a85f61f495feff5c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b7f51040defff318 input=a9049054013a1b77]*/ |