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/textio.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/textio.c.h')
-rw-r--r-- | Modules/_io/clinic/textio.c.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h index 0ff0324..2a13abf 100644 --- a/Modules/_io/clinic/textio.c.h +++ b/Modules/_io/clinic/textio.c.h @@ -419,11 +419,14 @@ _io_TextIOWrapper_truncate(textio *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_TextIOWrapper_truncate_impl(self, pos); exit: @@ -548,4 +551,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored)) { return _io_TextIOWrapper_close_impl(self); } -/*[clinic end generated code: output=8bdd1035bf878d6f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=c3d1b2a5d2d2d429 input=a9049054013a1b77]*/ |