bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)

the bare METH_FASTCALL be used for functions with positional-only
parameters.
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index d16b1b4..85f207b 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -991,16 +991,11 @@
 
 /* AC: cannot convert yet, as needs PEP 457 group support in inspect */
 static PyObject *
-builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs,
-                PyObject *kwnames)
+builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *v, *result, *dflt = NULL;
     PyObject *name;
 
-    if (!_PyArg_NoStackKeywords("getattr", kwnames)) {
-        return NULL;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "getattr", 2, 3, &v, &name, &dflt))
         return NULL;
 
@@ -1301,16 +1296,11 @@
 
 /* AC: cannot convert yet, as needs PEP 457 group support in inspect */
 static PyObject *
-builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs,
-             PyObject *kwnames)
+builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *it, *res;
     PyObject *def = NULL;
 
-    if (!_PyArg_NoStackKeywords("next", kwnames)) {
-        return NULL;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "next", 1, 2, &it, &def))
         return NULL;
 
@@ -2130,7 +2120,7 @@
 "reverse flag can be set to request the result in descending order.");
 
 #define BUILTIN_SORTED_METHODDEF    \
-    {"sorted", (PyCFunction)builtin_sorted, METH_FASTCALL, builtin_sorted__doc__},
+    {"sorted", (PyCFunction)builtin_sorted, METH_FASTCALL | METH_KEYWORDS, builtin_sorted__doc__},
 
 static PyObject *
 builtin_sorted(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
@@ -2622,7 +2612,7 @@
 
 static PyMethodDef builtin_methods[] = {
     {"__build_class__", (PyCFunction)builtin___build_class__,
-     METH_FASTCALL, build_class_doc},
+     METH_FASTCALL | METH_KEYWORDS, build_class_doc},
     {"__import__",      (PyCFunction)builtin___import__, METH_VARARGS | METH_KEYWORDS, import_doc},
     BUILTIN_ABS_METHODDEF
     BUILTIN_ALL_METHODDEF
@@ -2656,7 +2646,7 @@
     BUILTIN_OCT_METHODDEF
     BUILTIN_ORD_METHODDEF
     BUILTIN_POW_METHODDEF
-    {"print",           (PyCFunction)builtin_print,      METH_FASTCALL, print_doc},
+    {"print",           (PyCFunction)builtin_print,      METH_FASTCALL | METH_KEYWORDS, print_doc},
     BUILTIN_REPR_METHODDEF
     {"round",           (PyCFunction)builtin_round,      METH_VARARGS | METH_KEYWORDS, round_doc},
     BUILTIN_SETATTR_METHODDEF
diff --git a/Python/clinic/_warnings.c.h b/Python/clinic/_warnings.c.h
index 550c73f..334f9d1 100644
--- a/Python/clinic/_warnings.c.h
+++ b/Python/clinic/_warnings.c.h
@@ -9,7 +9,7 @@
 "Issue a warning, or maybe ignore it or raise an exception.");
 
 #define WARNINGS_WARN_METHODDEF    \
-    {"warn", (PyCFunction)warnings_warn, METH_FASTCALL, warnings_warn__doc__},
+    {"warn", (PyCFunction)warnings_warn, METH_FASTCALL|METH_KEYWORDS, warnings_warn__doc__},
 
 static PyObject *
 warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category,
@@ -35,4 +35,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=acadf1788059034c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=74b1a7d1ee41816d input=a9049054013a1b77]*/
diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h
index 0e46f94..fa327da 100644
--- a/Python/clinic/bltinmodule.c.h
+++ b/Python/clinic/bltinmodule.c.h
@@ -88,16 +88,12 @@
 builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec);
 
 static PyObject *
-builtin_format(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_format(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *value;
     PyObject *format_spec = NULL;
 
-    if (!_PyArg_NoStackKeywords("format", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_ParseStack(args, nargs, "O|U:format",
         &value, &format_spec)) {
         goto exit;
@@ -154,7 +150,7 @@
 "in addition to any features explicitly specified.");
 
 #define BUILTIN_COMPILE_METHODDEF    \
-    {"compile", (PyCFunction)builtin_compile, METH_FASTCALL, builtin_compile__doc__},
+    {"compile", (PyCFunction)builtin_compile, METH_FASTCALL|METH_KEYWORDS, builtin_compile__doc__},
 
 static PyObject *
 builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
@@ -197,16 +193,12 @@
 builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y);
 
 static PyObject *
-builtin_divmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_divmod(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *x;
     PyObject *y;
 
-    if (!_PyArg_NoStackKeywords("divmod", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "divmod",
         2, 2,
         &x, &y)) {
@@ -238,17 +230,13 @@
                   PyObject *locals);
 
 static PyObject *
-builtin_eval(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_eval(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *source;
     PyObject *globals = Py_None;
     PyObject *locals = Py_None;
 
-    if (!_PyArg_NoStackKeywords("eval", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "eval",
         1, 3,
         &source, &globals, &locals)) {
@@ -280,17 +268,13 @@
                   PyObject *locals);
 
 static PyObject *
-builtin_exec(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_exec(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *source;
     PyObject *globals = Py_None;
     PyObject *locals = Py_None;
 
-    if (!_PyArg_NoStackKeywords("exec", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "exec",
         1, 3,
         &source, &globals, &locals)) {
@@ -338,16 +322,12 @@
 builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name);
 
 static PyObject *
-builtin_hasattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_hasattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *obj;
     PyObject *name;
 
-    if (!_PyArg_NoStackKeywords("hasattr", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "hasattr",
         2, 2,
         &obj, &name)) {
@@ -387,17 +367,13 @@
                      PyObject *value);
 
 static PyObject *
-builtin_setattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_setattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *obj;
     PyObject *name;
     PyObject *value;
 
-    if (!_PyArg_NoStackKeywords("setattr", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "setattr",
         3, 3,
         &obj, &name, &value)) {
@@ -424,16 +400,12 @@
 builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name);
 
 static PyObject *
-builtin_delattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_delattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *obj;
     PyObject *name;
 
-    if (!_PyArg_NoStackKeywords("delattr", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "delattr",
         2, 2,
         &obj, &name)) {
@@ -537,17 +509,13 @@
 builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z);
 
 static PyObject *
-builtin_pow(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_pow(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *x;
     PyObject *y;
     PyObject *z = Py_None;
 
-    if (!_PyArg_NoStackKeywords("pow", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "pow",
         2, 3,
         &x, &y, &z)) {
@@ -578,15 +546,11 @@
 builtin_input_impl(PyObject *module, PyObject *prompt);
 
 static PyObject *
-builtin_input(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_input(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *prompt = NULL;
 
-    if (!_PyArg_NoStackKeywords("input", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "input",
         0, 1,
         &prompt)) {
@@ -626,16 +590,12 @@
 builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start);
 
 static PyObject *
-builtin_sum(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_sum(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *iterable;
     PyObject *start = NULL;
 
-    if (!_PyArg_NoStackKeywords("sum", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "sum",
         1, 2,
         &iterable, &start)) {
@@ -665,16 +625,12 @@
                         PyObject *class_or_tuple);
 
 static PyObject *
-builtin_isinstance(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_isinstance(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *obj;
     PyObject *class_or_tuple;
 
-    if (!_PyArg_NoStackKeywords("isinstance", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "isinstance",
         2, 2,
         &obj, &class_or_tuple)) {
@@ -704,16 +660,12 @@
                         PyObject *class_or_tuple);
 
 static PyObject *
-builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *cls;
     PyObject *class_or_tuple;
 
-    if (!_PyArg_NoStackKeywords("issubclass", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "issubclass",
         2, 2,
         &cls, &class_or_tuple)) {
@@ -724,4 +676,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=e1a7417a7b33eeec input=a9049054013a1b77]*/
+/*[clinic end generated code: output=09752daa8cdd6ec7 input=a9049054013a1b77]*/
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index 5f4bad2..ddd694f 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -82,16 +82,12 @@
                            PyObject *path);
 
 static PyObject *
-_imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+_imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyCodeObject *code;
     PyObject *path;
 
-    if (!_PyArg_NoStackKeywords("_fix_co_filename", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_ParseStack(args, nargs, "O!U:_fix_co_filename",
         &PyCode_Type, &code, &path)) {
         goto exit;
@@ -279,16 +275,12 @@
 _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file);
 
 static PyObject *
-_imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+_imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *spec;
     PyObject *file = NULL;
 
-    if (!_PyArg_NoStackKeywords("create_dynamic", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_UnpackStack(args, nargs, "create_dynamic",
         1, 2,
         &spec, &file)) {
@@ -369,4 +361,4 @@
 #ifndef _IMP_EXEC_DYNAMIC_METHODDEF
     #define _IMP_EXEC_DYNAMIC_METHODDEF
 #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=b970357dbbe25ee4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d068dd493e513604 input=a9049054013a1b77]*/
diff --git a/Python/clinic/marshal.c.h b/Python/clinic/marshal.c.h
index 64504ba..a946635 100644
--- a/Python/clinic/marshal.c.h
+++ b/Python/clinic/marshal.c.h
@@ -27,17 +27,13 @@
                   int version);
 
 static PyObject *
-marshal_dump(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+marshal_dump(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *value;
     PyObject *file;
     int version = Py_MARSHAL_VERSION;
 
-    if (!_PyArg_NoStackKeywords("dump", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_ParseStack(args, nargs, "OO|i:dump",
         &value, &file, &version)) {
         goto exit;
@@ -88,16 +84,12 @@
 marshal_dumps_impl(PyObject *module, PyObject *value, int version);
 
 static PyObject *
-marshal_dumps(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+marshal_dumps(PyObject *module, PyObject **args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *value;
     int version = Py_MARSHAL_VERSION;
 
-    if (!_PyArg_NoStackKeywords("dumps", kwnames)) {
-        goto exit;
-    }
-
     if (!_PyArg_ParseStack(args, nargs, "O|i:dumps",
         &value, &version)) {
         goto exit;
@@ -142,4 +134,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=7b147a648614af7e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=15e284a34abfd26a input=a9049054013a1b77]*/