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.
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index 783ed4e..9ee20fb 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -318,11 +318,15 @@
PyObject *spec;
PyObject *file = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "create_dynamic",
- 1, 2,
- &spec, &file)) {
+ if (!_PyArg_CheckPositional("create_dynamic", nargs, 1, 2)) {
goto exit;
}
+ spec = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ file = args[1];
+skip_optional:
return_value = _imp_create_dynamic_impl(module, spec, file);
exit:
@@ -433,4 +437,4 @@
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=22062cee6e8ba7f3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2409b8feeafe7c4b input=a9049054013a1b77]*/