mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 08:42:28 +00:00
Backport METH_FASTCALL from Python 3.7 (#328)
This commit is contained in:
parent
70c97f598b
commit
cf73bbd678
102 changed files with 2896 additions and 3301 deletions
|
@ -52,7 +52,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,
|
||||
|
@ -95,7 +95,7 @@ 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};
|
||||
|
@ -105,10 +105,6 @@ bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwn
|
|||
&frm, &to)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_maketrans_impl(&frm, &to);
|
||||
|
||||
exit:
|
||||
|
@ -145,7 +141,7 @@ 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};
|
||||
|
@ -156,10 +152,6 @@ bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, Py
|
|||
&old, &new, &count)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("replace", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_replace_impl(self, &old, &new, count);
|
||||
|
||||
exit:
|
||||
|
@ -190,7 +182,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,
|
||||
|
@ -265,7 +257,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,
|
||||
|
@ -326,7 +318,7 @@ 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;
|
||||
|
@ -336,10 +328,6 @@ bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO
|
|||
&index, _getbytevalue, &item)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_insert_impl(self, index, item);
|
||||
|
||||
exit:
|
||||
|
@ -407,7 +395,7 @@ 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;
|
||||
|
@ -416,10 +404,6 @@ bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObje
|
|||
&index)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("pop", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_pop_impl(self, index);
|
||||
|
||||
exit:
|
||||
|
@ -471,7 +455,7 @@ 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;
|
||||
|
@ -481,10 +465,6 @@ bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyOb
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_strip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -506,7 +486,7 @@ 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;
|
||||
|
@ -516,10 +496,6 @@ bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_lstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -541,7 +517,7 @@ 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;
|
||||
|
@ -551,10 +527,6 @@ bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_rstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -577,7 +549,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,
|
||||
|
@ -625,7 +597,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);
|
||||
|
@ -709,7 +681,7 @@ 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;
|
||||
|
@ -718,10 +690,6 @@ bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs,
|
|||
&proto)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytearray_reduce_ex_impl(self, proto);
|
||||
|
||||
exit:
|
||||
|
@ -745,4 +713,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return bytearray_sizeof_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=c1b1b83b0e19df74 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=c2804d009182328c input=a9049054013a1b77]*/
|
||||
|
|
|
@ -18,7 +18,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);
|
||||
|
@ -137,7 +137,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);
|
||||
|
@ -191,7 +191,7 @@ 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;
|
||||
|
@ -201,10 +201,6 @@ bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kw
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_strip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -226,7 +222,7 @@ 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;
|
||||
|
@ -236,10 +232,6 @@ bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *k
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_lstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -261,7 +253,7 @@ 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;
|
||||
|
@ -271,10 +263,6 @@ bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *k
|
|||
&bytes)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_rstrip_impl(self, bytes);
|
||||
|
||||
exit:
|
||||
|
@ -294,7 +282,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,
|
||||
|
@ -337,7 +325,7 @@ 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};
|
||||
|
@ -347,10 +335,6 @@ bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames
|
|||
&frm, &to)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_maketrans_impl(&frm, &to);
|
||||
|
||||
exit:
|
||||
|
@ -387,7 +371,7 @@ 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};
|
||||
|
@ -398,10 +382,6 @@ bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *
|
|||
&old, &new, &count)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("replace", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = bytes_replace_impl(self, &old, &new, count);
|
||||
|
||||
exit:
|
||||
|
@ -433,7 +413,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,
|
||||
|
@ -468,7 +448,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);
|
||||
|
@ -520,4 +500,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=debf785947e0eec2 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=fc9e02359cc56d36 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -16,7 +16,7 @@ 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;
|
||||
|
@ -27,10 +27,6 @@ dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *k
|
|||
&iterable, &value)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("fromkeys", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = dict_fromkeys_impl(type, iterable, value);
|
||||
|
||||
exit:
|
||||
|
@ -45,4 +41,4 @@ PyDoc_STRVAR(dict___contains____doc__,
|
|||
|
||||
#define DICT___CONTAINS___METHODDEF \
|
||||
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
|
||||
/*[clinic end generated code: output=69f3d767ed44e8ec input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d6997a57899cf28d input=a9049054013a1b77]*/
|
||||
|
|
136
third_party/python/Objects/clinic/odictobject.inc
vendored
136
third_party/python/Objects/clinic/odictobject.inc
vendored
|
@ -1,136 +0,0 @@
|
|||
/* clang-format off */
|
||||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
PyDoc_STRVAR(OrderedDict_fromkeys__doc__,
|
||||
"fromkeys($type, /, iterable, value=None)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"New ordered dictionary with keys from S.\n"
|
||||
"\n"
|
||||
"If not specified, the value defaults to None.");
|
||||
|
||||
#define ORDEREDDICT_FROMKEYS_METHODDEF \
|
||||
{"fromkeys", (PyCFunction)OrderedDict_fromkeys, METH_FASTCALL|METH_CLASS, OrderedDict_fromkeys__doc__},
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_fromkeys_impl(PyTypeObject *type, PyObject *seq, PyObject *value);
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"iterable", "value", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:fromkeys", _keywords, 0};
|
||||
PyObject *seq;
|
||||
PyObject *value = Py_None;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&seq, &value)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = OrderedDict_fromkeys_impl(type, seq, value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(OrderedDict_setdefault__doc__,
|
||||
"setdefault($self, /, key, default=None)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"od.get(k,d), also set od[k]=d if k not in od.");
|
||||
|
||||
#define ORDEREDDICT_SETDEFAULT_METHODDEF \
|
||||
{"setdefault", (PyCFunction)OrderedDict_setdefault, METH_FASTCALL, OrderedDict_setdefault__doc__},
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||
PyObject *failobj);
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_setdefault(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"key", "default", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
|
||||
PyObject *key;
|
||||
PyObject *failobj = Py_None;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&key, &failobj)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = OrderedDict_setdefault_impl(self, key, failobj);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(OrderedDict_popitem__doc__,
|
||||
"popitem($self, /, last=True)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Return (k, v) and remove a (key, value) pair.\n"
|
||||
"\n"
|
||||
"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__},
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_popitem_impl(PyODictObject *self, int last);
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_popitem(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"last", NULL};
|
||||
static _PyArg_Parser _parser = {"|p:popitem", _keywords, 0};
|
||||
int last = 1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&last)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = OrderedDict_popitem_impl(self, last);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(OrderedDict_move_to_end__doc__,
|
||||
"move_to_end($self, /, key, last=True)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"\"Move an existing element to the end (or beginning if last==False).\n"
|
||||
"\n"
|
||||
" Raises KeyError if the element does not exist.\n"
|
||||
" When last=True, acts like a fast version of self[key]=self.pop(key).");
|
||||
|
||||
#define ORDEREDDICT_MOVE_TO_END_METHODDEF \
|
||||
{"move_to_end", (PyCFunction)OrderedDict_move_to_end, METH_FASTCALL, OrderedDict_move_to_end__doc__},
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_move_to_end_impl(PyODictObject *self, PyObject *key, int last);
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_move_to_end(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"key", "last", NULL};
|
||||
static _PyArg_Parser _parser = {"O|p:move_to_end", _keywords, 0};
|
||||
PyObject *key;
|
||||
int last = 1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&key, &last)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = OrderedDict_move_to_end_impl(self, key, last);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=f2641e1277045b59 input=a9049054013a1b77]*/
|
|
@ -24,7 +24,7 @@ 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;
|
||||
|
@ -35,13 +35,9 @@ unicode_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnam
|
|||
&x, &y, &z)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = unicode_maketrans_impl(x, y, z);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=af4804dbf21463b5 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d1e48260a99031c2 input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue