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/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h
index 1165789..1c8fc2f 100644
--- a/Modules/clinic/mathmodule.c.h
+++ b/Modules/clinic/mathmodule.c.h
@@ -21,11 +21,11 @@
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "gcd",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("gcd", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = math_gcd_impl(module, a, b);
exit:
@@ -307,11 +307,11 @@
PyObject *p;
PyObject *q;
- if (!_PyArg_UnpackStack(args, nargs, "dist",
- 2, 2,
- &p, &q)) {
+ if (!_PyArg_CheckPositional("dist", nargs, 2, 2)) {
goto exit;
}
+ p = args[0];
+ q = args[1];
return_value = math_dist_impl(module, p, q);
exit:
@@ -548,4 +548,4 @@
exit:
return return_value;
}
-/*[clinic end generated code: output=2fe4fecd85585313 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f3264ab0ef57ba0a input=a9049054013a1b77]*/