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/Objects/call.c b/Objects/call.c
index 6c8a640..c3cc31d 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -521,9 +521,19 @@
case METH_FASTCALL:
{
+ if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
+ goto no_keyword_error;
+ }
+
+ result = (*(_PyCFunctionFast)meth) (self, args, nargs);
+ break;
+ }
+
+ case METH_FASTCALL | METH_KEYWORDS:
+ {
PyObject **stack;
PyObject *kwnames;
- _PyCFunctionFast fastmeth = (_PyCFunctionFast)meth;
+ _PyCFunctionFastWithKeywords fastmeth = (_PyCFunctionFastWithKeywords)meth;
if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) {
goto exit;
@@ -631,8 +641,15 @@
break;
case METH_FASTCALL:
+ if (nkwargs) {
+ goto no_keyword_error;
+ }
+ result = ((_PyCFunctionFast)meth) (self, args, nargs);
+ break;
+
+ case METH_FASTCALL | METH_KEYWORDS:
/* Fast-path: avoid temporary dict to pass keyword arguments */
- result = ((_PyCFunctionFast)meth) (self, args, nargs, kwnames);
+ result = ((_PyCFunctionFastWithKeywords)meth) (self, args, nargs, kwnames);
break;
case METH_VARARGS:
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h
index 8363dbd..319c86e 100644
--- a/Objects/clinic/bytearrayobject.c.h
+++ b/Objects/clinic/bytearrayobject.c.h
@@ -51,7 +51,7 @@
"The remaining characters are mapped through the given translation table.");
#define BYTEARRAY_TRANSLATE_METHODDEF \
- {"translate", (PyCFunction)bytearray_translate, METH_FASTCALL, bytearray_translate__doc__},
+ {"translate", (PyCFunction)bytearray_translate, METH_FASTCALL|METH_KEYWORDS, bytearray_translate__doc__},
static PyObject *
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
@@ -94,16 +94,12 @@
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
-bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
Py_buffer to = {NULL, NULL};
- if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "y*y*:maketrans",
&frm, &to)) {
goto exit;
@@ -144,17 +140,13 @@
Py_buffer *new, Py_ssize_t count);
static PyObject *
-bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
Py_buffer new = {NULL, NULL};
Py_ssize_t count = -1;
- if (!_PyArg_NoStackKeywords("replace", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "y*y*|n:replace",
&old, &new, &count)) {
goto exit;
@@ -189,7 +181,7 @@
" -1 (the default value) means no limit.");
#define BYTEARRAY_SPLIT_METHODDEF \
- {"split", (PyCFunction)bytearray_split, METH_FASTCALL, bytearray_split__doc__},
+ {"split", (PyCFunction)bytearray_split, METH_FASTCALL|METH_KEYWORDS, bytearray_split__doc__},
static PyObject *
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
@@ -263,7 +255,7 @@
"Splitting is done starting at the end of the bytearray and working to the front.");
#define BYTEARRAY_RSPLIT_METHODDEF \
- {"rsplit", (PyCFunction)bytearray_rsplit, METH_FASTCALL, bytearray_rsplit__doc__},
+ {"rsplit", (PyCFunction)bytearray_rsplit, METH_FASTCALL|METH_KEYWORDS, bytearray_rsplit__doc__},
static PyObject *
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep,
@@ -324,16 +316,12 @@
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item);
static PyObject *
-bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t index;
int item;
- if (!_PyArg_NoStackKeywords("insert", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "nO&:insert",
&index, _getbytevalue, &item)) {
goto exit;
@@ -405,15 +393,11 @@
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index);
static PyObject *
-bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t index = -1;
- if (!_PyArg_NoStackKeywords("pop", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "|n:pop",
&index)) {
goto exit;
@@ -469,15 +453,11 @@
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
-bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!_PyArg_NoStackKeywords("strip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "strip",
0, 1,
&bytes)) {
@@ -504,15 +484,11 @@
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
-bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "lstrip",
0, 1,
&bytes)) {
@@ -539,15 +515,11 @@
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
-bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "rstrip",
0, 1,
&bytes)) {
@@ -575,7 +547,7 @@
" can handle UnicodeDecodeErrors.");
#define BYTEARRAY_DECODE_METHODDEF \
- {"decode", (PyCFunction)bytearray_decode, METH_FASTCALL, bytearray_decode__doc__},
+ {"decode", (PyCFunction)bytearray_decode, METH_FASTCALL|METH_KEYWORDS, bytearray_decode__doc__},
static PyObject *
bytearray_decode_impl(PyByteArrayObject *self, const char *encoding,
@@ -623,7 +595,7 @@
"true.");
#define BYTEARRAY_SPLITLINES_METHODDEF \
- {"splitlines", (PyCFunction)bytearray_splitlines, METH_FASTCALL, bytearray_splitlines__doc__},
+ {"splitlines", (PyCFunction)bytearray_splitlines, METH_FASTCALL|METH_KEYWORDS, bytearray_splitlines__doc__},
static PyObject *
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends);
@@ -707,15 +679,11 @@
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto);
static PyObject *
-bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int proto = 0;
- if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "|i:__reduce_ex__",
&proto)) {
goto exit;
@@ -743,4 +711,4 @@
{
return bytearray_sizeof_impl(self);
}
-/*[clinic end generated code: output=f0079d8ee82614f7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e53f10084457a46b input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h
index da17cf8..315f6f2 100644
--- a/Objects/clinic/bytesobject.c.h
+++ b/Objects/clinic/bytesobject.c.h
@@ -17,7 +17,7 @@
" -1 (the default value) means no limit.");
#define BYTES_SPLIT_METHODDEF \
- {"split", (PyCFunction)bytes_split, METH_FASTCALL, bytes_split__doc__},
+ {"split", (PyCFunction)bytes_split, METH_FASTCALL|METH_KEYWORDS, bytes_split__doc__},
static PyObject *
bytes_split_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
@@ -136,7 +136,7 @@
"Splitting is done starting at the end of the bytes and working to the front.");
#define BYTES_RSPLIT_METHODDEF \
- {"rsplit", (PyCFunction)bytes_rsplit, METH_FASTCALL, bytes_rsplit__doc__},
+ {"rsplit", (PyCFunction)bytes_rsplit, METH_FASTCALL|METH_KEYWORDS, bytes_rsplit__doc__},
static PyObject *
bytes_rsplit_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
@@ -190,15 +190,11 @@
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
-bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!_PyArg_NoStackKeywords("strip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "strip",
0, 1,
&bytes)) {
@@ -225,15 +221,11 @@
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
-bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "lstrip",
0, 1,
&bytes)) {
@@ -260,15 +252,11 @@
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
-bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "rstrip",
0, 1,
&bytes)) {
@@ -293,7 +281,7 @@
"The remaining characters are mapped through the given translation table.");
#define BYTES_TRANSLATE_METHODDEF \
- {"translate", (PyCFunction)bytes_translate, METH_FASTCALL, bytes_translate__doc__},
+ {"translate", (PyCFunction)bytes_translate, METH_FASTCALL|METH_KEYWORDS, bytes_translate__doc__},
static PyObject *
bytes_translate_impl(PyBytesObject *self, PyObject *table,
@@ -336,16 +324,12 @@
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
-bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
Py_buffer to = {NULL, NULL};
- if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "y*y*:maketrans",
&frm, &to)) {
goto exit;
@@ -386,17 +370,13 @@
Py_ssize_t count);
static PyObject *
-bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
Py_buffer new = {NULL, NULL};
Py_ssize_t count = -1;
- if (!_PyArg_NoStackKeywords("replace", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "y*y*|n:replace",
&old, &new, &count)) {
goto exit;
@@ -432,7 +412,7 @@
" can handle UnicodeDecodeErrors.");
#define BYTES_DECODE_METHODDEF \
- {"decode", (PyCFunction)bytes_decode, METH_FASTCALL, bytes_decode__doc__},
+ {"decode", (PyCFunction)bytes_decode, METH_FASTCALL|METH_KEYWORDS, bytes_decode__doc__},
static PyObject *
bytes_decode_impl(PyBytesObject *self, const char *encoding,
@@ -467,7 +447,7 @@
"true.");
#define BYTES_SPLITLINES_METHODDEF \
- {"splitlines", (PyCFunction)bytes_splitlines, METH_FASTCALL, bytes_splitlines__doc__},
+ {"splitlines", (PyCFunction)bytes_splitlines, METH_FASTCALL|METH_KEYWORDS, bytes_splitlines__doc__},
static PyObject *
bytes_splitlines_impl(PyBytesObject *self, int keepends);
@@ -519,4 +499,4 @@
exit:
return return_value;
}
-/*[clinic end generated code: output=a82999760469bbec input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9e3374bd7d04c163 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h
index 2e11cd2..538d52e 100644
--- a/Objects/clinic/dictobject.c.h
+++ b/Objects/clinic/dictobject.c.h
@@ -15,16 +15,12 @@
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
static PyObject *
-dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *iterable;
PyObject *value = Py_None;
- if (!_PyArg_NoStackKeywords("fromkeys", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "fromkeys",
1, 2,
&iterable, &value)) {
@@ -58,16 +54,12 @@
dict_get_impl(PyDictObject *self, PyObject *key, PyObject *default_value);
static PyObject *
-dict_get(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+dict_get(PyDictObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_NoStackKeywords("get", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "get",
1, 2,
&key, &default_value)) {
@@ -95,16 +87,12 @@
PyObject *default_value);
static PyObject *
-dict_setdefault(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+dict_setdefault(PyDictObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "setdefault",
1, 2,
&key, &default_value)) {
@@ -115,4 +103,4 @@
exit:
return return_value;
}
-/*[clinic end generated code: output=49e03ab4360f5be0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8d09902e60b7ab02 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h
index 893629b..9325154 100644
--- a/Objects/clinic/floatobject.c.h
+++ b/Objects/clinic/floatobject.c.h
@@ -53,15 +53,11 @@
float___round___impl(PyObject *self, PyObject *o_ndigits);
static PyObject *
-float___round__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+float___round__(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *o_ndigits = NULL;
- if (!_PyArg_NoStackKeywords("__round__", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "__round__",
0, 1,
&o_ndigits)) {
@@ -267,16 +263,12 @@
const char *fmt);
static PyObject *
-float___set_format__(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+float___set_format__(PyTypeObject *type, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
const char *typestr;
const char *fmt;
- if (!_PyArg_NoStackKeywords("__set_format__", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "ss:__set_format__",
&typestr, &fmt)) {
goto exit;
@@ -313,4 +305,4 @@
exit:
return return_value;
}
-/*[clinic end generated code: output=b2271e7413b36162 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=90c06ea9d72130cc input=a9049054013a1b77]*/
diff --git a/Objects/clinic/listobject.c.h b/Objects/clinic/listobject.c.h
index d5b9b1e..d22ce22 100644
--- a/Objects/clinic/listobject.c.h
+++ b/Objects/clinic/listobject.c.h
@@ -15,16 +15,12 @@
list_insert_impl(PyListObject *self, Py_ssize_t index, PyObject *object);
static PyObject *
-list_insert(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+list_insert(PyListObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t index;
PyObject *object;
- if (!_PyArg_NoStackKeywords("insert", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "nO:insert",
&index, &object)) {
goto exit;
@@ -104,15 +100,11 @@
list_pop_impl(PyListObject *self, Py_ssize_t index);
static PyObject *
-list_pop(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+list_pop(PyListObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t index = -1;
- if (!_PyArg_NoStackKeywords("pop", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "|n:pop",
&index)) {
goto exit;
@@ -130,7 +122,7 @@
"Stable sort *IN PLACE*.");
#define LIST_SORT_METHODDEF \
- {"sort", (PyCFunction)list_sort, METH_FASTCALL, list_sort__doc__},
+ {"sort", (PyCFunction)list_sort, METH_FASTCALL|METH_KEYWORDS, list_sort__doc__},
static PyObject *
list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse);
@@ -188,17 +180,13 @@
Py_ssize_t stop);
static PyObject *
-list_index(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+list_index(PyListObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *value;
Py_ssize_t start = 0;
Py_ssize_t stop = PY_SSIZE_T_MAX;
- if (!_PyArg_NoStackKeywords("index", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index",
&value, _PyEval_SliceIndexNotNone, &start, _PyEval_SliceIndexNotNone, &stop)) {
goto exit;
@@ -297,4 +285,4 @@
{
return list___reversed___impl(self);
}
-/*[clinic end generated code: output=63cbe6d6320e916f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=4a4f72a5e7ff5068 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h
index 81bc97f..1b706d6 100644
--- a/Objects/clinic/longobject.c.h
+++ b/Objects/clinic/longobject.c.h
@@ -139,7 +139,7 @@
" is raised.");
#define INT_TO_BYTES_METHODDEF \
- {"to_bytes", (PyCFunction)int_to_bytes, METH_FASTCALL, int_to_bytes__doc__},
+ {"to_bytes", (PyCFunction)int_to_bytes, METH_FASTCALL|METH_KEYWORDS, int_to_bytes__doc__},
static PyObject *
int_to_bytes_impl(PyObject *self, Py_ssize_t length, PyObject *byteorder,
@@ -186,7 +186,7 @@
" Indicates whether two\'s complement is used to represent the integer.");
#define INT_FROM_BYTES_METHODDEF \
- {"from_bytes", (PyCFunction)int_from_bytes, METH_FASTCALL|METH_CLASS, int_from_bytes__doc__},
+ {"from_bytes", (PyCFunction)int_from_bytes, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, int_from_bytes__doc__},
static PyObject *
int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj,
@@ -211,4 +211,4 @@
exit:
return return_value;
}
-/*[clinic end generated code: output=c1ce9c11929b0bab input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c9adfdc329651cc4 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/odictobject.c.h b/Objects/clinic/odictobject.c.h
index 0e5092c..6c1cb91 100644
--- a/Objects/clinic/odictobject.c.h
+++ b/Objects/clinic/odictobject.c.h
@@ -9,7 +9,7 @@
"Create a new ordered dictionary with keys from iterable and values set to value.");
#define ORDEREDDICT_FROMKEYS_METHODDEF \
- {"fromkeys", (PyCFunction)OrderedDict_fromkeys, METH_FASTCALL|METH_CLASS, OrderedDict_fromkeys__doc__},
+ {"fromkeys", (PyCFunction)OrderedDict_fromkeys, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, OrderedDict_fromkeys__doc__},
static PyObject *
OrderedDict_fromkeys_impl(PyTypeObject *type, PyObject *seq, PyObject *value);
@@ -42,7 +42,7 @@
"Return the value for key if key is in the dictionary, else default.");
#define ORDEREDDICT_SETDEFAULT_METHODDEF \
- {"setdefault", (PyCFunction)OrderedDict_setdefault, METH_FASTCALL, OrderedDict_setdefault__doc__},
+ {"setdefault", (PyCFunction)OrderedDict_setdefault, METH_FASTCALL|METH_KEYWORDS, OrderedDict_setdefault__doc__},
static PyObject *
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
@@ -76,7 +76,7 @@
"Pairs are returned in LIFO order if last is true or FIFO order if false.");
#define ORDEREDDICT_POPITEM_METHODDEF \
- {"popitem", (PyCFunction)OrderedDict_popitem, METH_FASTCALL, OrderedDict_popitem__doc__},
+ {"popitem", (PyCFunction)OrderedDict_popitem, METH_FASTCALL|METH_KEYWORDS, OrderedDict_popitem__doc__},
static PyObject *
OrderedDict_popitem_impl(PyODictObject *self, int last);
@@ -108,7 +108,7 @@
"Raise KeyError if the element does not exist.");
#define ORDEREDDICT_MOVE_TO_END_METHODDEF \
- {"move_to_end", (PyCFunction)OrderedDict_move_to_end, METH_FASTCALL, OrderedDict_move_to_end__doc__},
+ {"move_to_end", (PyCFunction)OrderedDict_move_to_end, METH_FASTCALL|METH_KEYWORDS, OrderedDict_move_to_end__doc__},
static PyObject *
OrderedDict_move_to_end_impl(PyODictObject *self, PyObject *key, int last);
@@ -131,4 +131,4 @@
exit:
return return_value;
}
-/*[clinic end generated code: output=a19a24ac37b42e5e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b2f82eca6e8c8084 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/tupleobject.c.h b/Objects/clinic/tupleobject.c.h
index a6eedff..c453e58 100644
--- a/Objects/clinic/tupleobject.c.h
+++ b/Objects/clinic/tupleobject.c.h
@@ -18,17 +18,13 @@
Py_ssize_t stop);
static PyObject *
-tuple_index(PyTupleObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+tuple_index(PyTupleObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *value;
Py_ssize_t start = 0;
Py_ssize_t stop = PY_SSIZE_T_MAX;
- if (!_PyArg_NoStackKeywords("index", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index",
&value, _PyEval_SliceIndexNotNone, &start, _PyEval_SliceIndexNotNone, &stop)) {
goto exit;
@@ -99,4 +95,4 @@
{
return tuple___getnewargs___impl(self);
}
-/*[clinic end generated code: output=70b4de94a0002ec3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d24a9893b3a740c6 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h
index 7ae7a99..ca90e6d 100644
--- a/Objects/clinic/unicodeobject.c.h
+++ b/Objects/clinic/unicodeobject.c.h
@@ -77,16 +77,12 @@
unicode_center_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar);
static PyObject *
-unicode_center(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_center(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t width;
Py_UCS4 fillchar = ' ';
- if (!_PyArg_NoStackKeywords("center", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "n|O&:center",
&width, convert_uc, &fillchar)) {
goto exit;
@@ -113,7 +109,7 @@
" codecs.register_error that can handle UnicodeEncodeErrors.");
#define UNICODE_ENCODE_METHODDEF \
- {"encode", (PyCFunction)unicode_encode, METH_FASTCALL, unicode_encode__doc__},
+ {"encode", (PyCFunction)unicode_encode, METH_FASTCALL|METH_KEYWORDS, unicode_encode__doc__},
static PyObject *
unicode_encode_impl(PyObject *self, const char *encoding, const char *errors);
@@ -146,7 +142,7 @@
"If tabsize is not given, a tab size of 8 characters is assumed.");
#define UNICODE_EXPANDTABS_METHODDEF \
- {"expandtabs", (PyCFunction)unicode_expandtabs, METH_FASTCALL, unicode_expandtabs__doc__},
+ {"expandtabs", (PyCFunction)unicode_expandtabs, METH_FASTCALL|METH_KEYWORDS, unicode_expandtabs__doc__},
static PyObject *
unicode_expandtabs_impl(PyObject *self, int tabsize);
@@ -429,16 +425,12 @@
unicode_ljust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar);
static PyObject *
-unicode_ljust(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_ljust(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t width;
Py_UCS4 fillchar = ' ';
- if (!_PyArg_NoStackKeywords("ljust", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "n|O&:ljust",
&width, convert_uc, &fillchar)) {
goto exit;
@@ -482,15 +474,11 @@
unicode_strip_impl(PyObject *self, PyObject *chars);
static PyObject *
-unicode_strip(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_strip(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *chars = Py_None;
- if (!_PyArg_NoStackKeywords("strip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "strip",
0, 1,
&chars)) {
@@ -517,15 +505,11 @@
unicode_lstrip_impl(PyObject *self, PyObject *chars);
static PyObject *
-unicode_lstrip(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_lstrip(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *chars = NULL;
- if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "lstrip",
0, 1,
&chars)) {
@@ -552,15 +536,11 @@
unicode_rstrip_impl(PyObject *self, PyObject *chars);
static PyObject *
-unicode_rstrip(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_rstrip(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *chars = NULL;
- if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_UnpackStack(args, nargs, "rstrip",
0, 1,
&chars)) {
@@ -593,17 +573,13 @@
Py_ssize_t count);
static PyObject *
-unicode_replace(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_replace(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *old;
PyObject *new;
Py_ssize_t count = -1;
- if (!_PyArg_NoStackKeywords("replace", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "UU|n:replace",
&old, &new, &count)) {
goto exit;
@@ -629,16 +605,12 @@
unicode_rjust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar);
static PyObject *
-unicode_rjust(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_rjust(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t width;
Py_UCS4 fillchar = ' ';
- if (!_PyArg_NoStackKeywords("rjust", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "n|O&:rjust",
&width, convert_uc, &fillchar)) {
goto exit;
@@ -664,7 +636,7 @@
" -1 (the default value) means no limit.");
#define UNICODE_SPLIT_METHODDEF \
- {"split", (PyCFunction)unicode_split, METH_FASTCALL, unicode_split__doc__},
+ {"split", (PyCFunction)unicode_split, METH_FASTCALL|METH_KEYWORDS, unicode_split__doc__},
static PyObject *
unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit);
@@ -737,7 +709,7 @@
"Splits are done starting at the end of the string and working to the front.");
#define UNICODE_RSPLIT_METHODDEF \
- {"rsplit", (PyCFunction)unicode_rsplit, METH_FASTCALL, unicode_rsplit__doc__},
+ {"rsplit", (PyCFunction)unicode_rsplit, METH_FASTCALL|METH_KEYWORDS, unicode_rsplit__doc__},
static PyObject *
unicode_rsplit_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit);
@@ -771,7 +743,7 @@
"true.");
#define UNICODE_SPLITLINES_METHODDEF \
- {"splitlines", (PyCFunction)unicode_splitlines, METH_FASTCALL, unicode_splitlines__doc__},
+ {"splitlines", (PyCFunction)unicode_splitlines, METH_FASTCALL|METH_KEYWORDS, unicode_splitlines__doc__},
static PyObject *
unicode_splitlines_impl(PyObject *self, int keepends);
@@ -833,17 +805,13 @@
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
static PyObject *
-unicode_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+unicode_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y = NULL;
PyObject *z = NULL;
- if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
- goto exit;
- }
-
if (!_PyArg_ParseStack(args, nargs, "O|UU:maketrans",
&x, &y, &z)) {
goto exit;
@@ -962,4 +930,4 @@
{
return unicode_sizeof_impl(self);
}
-/*[clinic end generated code: output=339a83c0c100dd17 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8fd799fd7f2cc724 input=a9049054013a1b77]*/
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index e446b80..c44ff47 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2341,8 +2341,8 @@
}
/* Note: dict.update() uses the METH_VARARGS|METH_KEYWORDS calling convention.
- Using METH_FASTCALL would make dict.update(**dict2) calls slower, see the
- issue #29312. */
+ Using METH_FASTCALL|METH_KEYWORDS would make dict.update(**dict2) calls
+ slower, see the issue #29312. */
static PyObject *
dict_update(PyObject *self, PyObject *args, PyObject *kwds)
{
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 3b3148f..d1a12a7 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3340,7 +3340,7 @@
TYPE_MRO_METHODDEF
TYPE___SUBCLASSES___METHODDEF
{"__prepare__", (PyCFunction)type_prepare,
- METH_FASTCALL | METH_CLASS,
+ METH_FASTCALL | METH_KEYWORDS | METH_CLASS,
PyDoc_STR("__prepare__() -> dict\n"
"used to create the namespace for the class statement")},
TYPE___INSTANCECHECK___METHODDEF