mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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.
This commit is contained in:
parent
aa0aa0492c
commit
6969eaf468
76 changed files with 616 additions and 1916 deletions
|
@ -520,10 +520,20 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **arg
|
|||
}
|
||||
|
||||
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 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject *
|
|||
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:
|
||||
|
|
|
@ -51,7 +51,7 @@ PyDoc_STRVAR(bytearray_translate__doc__,
|
|||
"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 @@ static PyObject *
|
|||
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 @@ bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old,
|
|||
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 @@ PyDoc_STRVAR(bytearray_split__doc__,
|
|||
" -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 @@ PyDoc_STRVAR(bytearray_rsplit__doc__,
|
|||
"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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ PyDoc_STRVAR(bytearray_decode__doc__,
|
|||
" 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 @@ PyDoc_STRVAR(bytearray_splitlines__doc__,
|
|||
"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 @@ static PyObject *
|
|||
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 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return bytearray_sizeof_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=f0079d8ee82614f7 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=e53f10084457a46b input=a9049054013a1b77]*/
|
||||
|
|
|
@ -17,7 +17,7 @@ PyDoc_STRVAR(bytes_split__doc__,
|
|||
" -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 @@ PyDoc_STRVAR(bytes_rsplit__doc__,
|
|||
"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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ PyDoc_STRVAR(bytes_translate__doc__,
|
|||
"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 @@ static PyObject *
|
|||
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 @@ bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
|
|||
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 @@ PyDoc_STRVAR(bytes_decode__doc__,
|
|||
" 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 @@ PyDoc_STRVAR(bytes_splitlines__doc__,
|
|||
"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 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a82999760469bbec input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=9e3374bd7d04c163 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -15,16 +15,12 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ dict_setdefault_impl(PyDictObject *self, PyObject *key,
|
|||
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 @@ dict_setdefault(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=49e03ab4360f5be0 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=8d09902e60b7ab02 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -53,15 +53,11 @@ static PyObject *
|
|||
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 @@ float___set_format___impl(PyTypeObject *type, const char *typestr,
|
|||
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 @@ float___format__(PyObject *self, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=b2271e7413b36162 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=90c06ea9d72130cc input=a9049054013a1b77]*/
|
||||
|
|
|
@ -15,16 +15,12 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ PyDoc_STRVAR(list_sort__doc__,
|
|||
"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 @@ list_index_impl(PyListObject *self, PyObject *value, Py_ssize_t start,
|
|||
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 @@ list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return list___reversed___impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=63cbe6d6320e916f input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=4a4f72a5e7ff5068 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -139,7 +139,7 @@ PyDoc_STRVAR(int_to_bytes__doc__,
|
|||
" 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 @@ PyDoc_STRVAR(int_from_bytes__doc__,
|
|||
" 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 @@ int_from_bytes(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=c1ce9c11929b0bab input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=c9adfdc329651cc4 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -9,7 +9,7 @@ PyDoc_STRVAR(OrderedDict_fromkeys__doc__,
|
|||
"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 @@ PyDoc_STRVAR(OrderedDict_setdefault__doc__,
|
|||
"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 @@ PyDoc_STRVAR(OrderedDict_popitem__doc__,
|
|||
"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 @@ PyDoc_STRVAR(OrderedDict_move_to_end__doc__,
|
|||
"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 @@ OrderedDict_move_to_end(PyODictObject *self, PyObject **args, Py_ssize_t nargs,
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a19a24ac37b42e5e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=b2f82eca6e8c8084 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -18,17 +18,13 @@ tuple_index_impl(PyTupleObject *self, PyObject *value, Py_ssize_t start,
|
|||
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 @@ tuple___getnewargs__(PyTupleObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return tuple___getnewargs___impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=70b4de94a0002ec3 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d24a9893b3a740c6 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -77,16 +77,12 @@ static PyObject *
|
|||
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 @@ PyDoc_STRVAR(unicode_encode__doc__,
|
|||
" 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 @@ PyDoc_STRVAR(unicode_expandtabs__doc__,
|
|||
"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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ static PyObject *
|
|||
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 @@ unicode_replace_impl(PyObject *self, PyObject *old, PyObject *new,
|
|||
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 @@ static PyObject *
|
|||
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 @@ PyDoc_STRVAR(unicode_split__doc__,
|
|||
" -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 @@ PyDoc_STRVAR(unicode_rsplit__doc__,
|
|||
"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 @@ PyDoc_STRVAR(unicode_splitlines__doc__,
|
|||
"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 @@ static PyObject *
|
|||
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 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return unicode_sizeof_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=339a83c0c100dd17 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=8fd799fd7f2cc724 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -2341,8 +2341,8 @@ dict_update_common(PyObject *self, PyObject *args, PyObject *kwds,
|
|||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
|
|
@ -3340,7 +3340,7 @@ static PyMethodDef type_methods[] = {
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue