summaryrefslogtreecommitdiffstats
path: root/Lib/test/clinic.test
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 /Lib/test/clinic.test
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 'Lib/test/clinic.test')
-rw-r--r--Lib/test/clinic.test12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/clinic.test b/Lib/test/clinic.test
index 7ae8f96..b8f2331 100644
--- a/Lib/test/clinic.test
+++ b/Lib/test/clinic.test
@@ -106,11 +106,15 @@ test_objects_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs
PyObject *a;
PyObject *b = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "test_objects_converter",
- 1, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("test_objects_converter", nargs, 1, 2)) {
goto exit;
}
+ a = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ b = args[1];
+skip_optional:
return_value = test_objects_converter_impl(module, a, b);
exit:
@@ -119,7 +123,7 @@ exit:
static PyObject *
test_objects_converter_impl(PyObject *module, PyObject *a, PyObject *b)
-/*[clinic end generated code: output=068c25d6ae8cd1ef input=4cbb3d9edd2a36f3]*/
+/*[clinic end generated code: output=58009c0e42b4834e input=4cbb3d9edd2a36f3]*/
/*[clinic input]
test_object_converter_subclass_of