2017-03-11 03:19:20 -04:00
|
|
|
/*[clinic input]
|
|
|
|
preserve
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
2022-08-11 18:25:49 -03:00
|
|
|
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
2023-08-31 18:42:34 -03:00
|
|
|
# include "pycore_gc.h" // PyGC_Head
|
|
|
|
# include "pycore_runtime.h" // _Py_ID()
|
2022-08-11 18:25:49 -03:00
|
|
|
#endif
|
2023-08-31 18:42:34 -03:00
|
|
|
#include "pycore_abstract.h" // _PyNumber_Index()
|
2024-01-08 20:00:55 -04:00
|
|
|
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
2023-10-17 09:30:31 -03:00
|
|
|
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
2022-08-11 18:25:49 -03:00
|
|
|
|
2017-03-11 03:19:20 -04:00
|
|
|
PyDoc_STRVAR(list_insert__doc__,
|
|
|
|
"insert($self, index, object, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Insert object before index.");
|
|
|
|
|
|
|
|
#define LIST_INSERT_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"insert", _PyCFunction_CAST(list_insert), METH_FASTCALL, list_insert__doc__},
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_insert_impl(PyListObject *self, Py_ssize_t index, PyObject *object);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-12-15 07:11:11 -04:00
|
|
|
list_insert(PyListObject *self, PyObject *const *args, Py_ssize_t nargs)
|
2017-03-11 03:19:20 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_ssize_t index;
|
|
|
|
PyObject *object;
|
|
|
|
|
2019-01-11 10:01:14 -04:00
|
|
|
if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
|
2017-03-11 03:19:20 -04:00
|
|
|
goto exit;
|
|
|
|
}
|
2019-01-11 10:01:14 -04:00
|
|
|
{
|
|
|
|
Py_ssize_t ival = -1;
|
2020-05-28 04:33:45 -03:00
|
|
|
PyObject *iobj = _PyNumber_Index(args[0]);
|
2019-01-11 10:01:14 -04:00
|
|
|
if (iobj != NULL) {
|
|
|
|
ival = PyLong_AsSsize_t(iobj);
|
|
|
|
Py_DECREF(iobj);
|
|
|
|
}
|
|
|
|
if (ival == -1 && PyErr_Occurred()) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
index = ival;
|
|
|
|
}
|
|
|
|
object = args[1];
|
2024-01-08 20:00:55 -04:00
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
2017-03-11 03:19:20 -04:00
|
|
|
return_value = list_insert_impl(self, index, object);
|
2024-01-08 20:00:55 -04:00
|
|
|
Py_END_CRITICAL_SECTION();
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2023-11-13 12:14:56 -04:00
|
|
|
PyDoc_STRVAR(py_list_clear__doc__,
|
2017-03-11 03:19:20 -04:00
|
|
|
"clear($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Remove all items from list.");
|
|
|
|
|
2023-11-13 12:14:56 -04:00
|
|
|
#define PY_LIST_CLEAR_METHODDEF \
|
|
|
|
{"clear", (PyCFunction)py_list_clear, METH_NOARGS, py_list_clear__doc__},
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2023-11-13 12:14:56 -04:00
|
|
|
py_list_clear_impl(PyListObject *self);
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2023-11-13 12:14:56 -04:00
|
|
|
py_list_clear(PyListObject *self, PyObject *Py_UNUSED(ignored))
|
2017-03-11 03:19:20 -04:00
|
|
|
{
|
2024-01-08 20:00:55 -04:00
|
|
|
PyObject *return_value = NULL;
|
|
|
|
|
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
|
|
|
return_value = py_list_clear_impl(self);
|
|
|
|
Py_END_CRITICAL_SECTION();
|
|
|
|
|
|
|
|
return return_value;
|
2017-03-11 03:19:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list_copy__doc__,
|
|
|
|
"copy($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Return a shallow copy of the list.");
|
|
|
|
|
|
|
|
#define LIST_COPY_METHODDEF \
|
|
|
|
{"copy", (PyCFunction)list_copy, METH_NOARGS, list_copy__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_copy_impl(PyListObject *self);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_copy(PyListObject *self, PyObject *Py_UNUSED(ignored))
|
|
|
|
{
|
2024-01-15 20:11:14 -04:00
|
|
|
PyObject *return_value = NULL;
|
|
|
|
|
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
|
|
|
return_value = list_copy_impl(self);
|
|
|
|
Py_END_CRITICAL_SECTION();
|
|
|
|
|
|
|
|
return return_value;
|
2017-03-11 03:19:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list_append__doc__,
|
|
|
|
"append($self, object, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Append object to the end of the list.");
|
|
|
|
|
|
|
|
#define LIST_APPEND_METHODDEF \
|
|
|
|
{"append", (PyCFunction)list_append, METH_O, list_append__doc__},
|
|
|
|
|
2024-01-15 20:11:14 -04:00
|
|
|
static PyObject *
|
|
|
|
list_append_impl(PyListObject *self, PyObject *object);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_append(PyListObject *self, PyObject *object)
|
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
|
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
|
|
|
return_value = list_append_impl(self, object);
|
|
|
|
Py_END_CRITICAL_SECTION();
|
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2024-03-12 19:28:23 -03:00
|
|
|
PyDoc_STRVAR(list_extend__doc__,
|
2017-03-11 03:19:20 -04:00
|
|
|
"extend($self, iterable, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Extend list by appending elements from the iterable.");
|
|
|
|
|
2024-03-12 19:28:23 -03:00
|
|
|
#define LIST_EXTEND_METHODDEF \
|
|
|
|
{"extend", (PyCFunction)list_extend, METH_O, list_extend__doc__},
|
2024-01-15 20:11:14 -04:00
|
|
|
|
2017-03-11 03:19:20 -04:00
|
|
|
PyDoc_STRVAR(list_pop__doc__,
|
|
|
|
"pop($self, index=-1, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Remove and return item at index (default last).\n"
|
|
|
|
"\n"
|
|
|
|
"Raises IndexError if list is empty or index is out of range.");
|
|
|
|
|
|
|
|
#define LIST_POP_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"pop", _PyCFunction_CAST(list_pop), METH_FASTCALL, list_pop__doc__},
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_pop_impl(PyListObject *self, Py_ssize_t index);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-12-15 07:11:11 -04:00
|
|
|
list_pop(PyListObject *self, PyObject *const *args, Py_ssize_t nargs)
|
2017-03-11 03:19:20 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_ssize_t index = -1;
|
|
|
|
|
2019-01-11 10:01:14 -04:00
|
|
|
if (!_PyArg_CheckPositional("pop", nargs, 0, 1)) {
|
2017-03-11 03:19:20 -04:00
|
|
|
goto exit;
|
|
|
|
}
|
2019-01-11 10:01:14 -04:00
|
|
|
if (nargs < 1) {
|
|
|
|
goto skip_optional;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
Py_ssize_t ival = -1;
|
2020-05-28 04:33:45 -03:00
|
|
|
PyObject *iobj = _PyNumber_Index(args[0]);
|
2019-01-11 10:01:14 -04:00
|
|
|
if (iobj != NULL) {
|
|
|
|
ival = PyLong_AsSsize_t(iobj);
|
|
|
|
Py_DECREF(iobj);
|
|
|
|
}
|
|
|
|
if (ival == -1 && PyErr_Occurred()) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
index = ival;
|
|
|
|
}
|
|
|
|
skip_optional:
|
2024-01-08 20:00:55 -04:00
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
2017-03-11 03:19:20 -04:00
|
|
|
return_value = list_pop_impl(self, index);
|
2024-01-08 20:00:55 -04:00
|
|
|
Py_END_CRITICAL_SECTION();
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list_sort__doc__,
|
|
|
|
"sort($self, /, *, key=None, reverse=False)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2019-06-01 01:10:02 -03:00
|
|
|
"Sort the list in ascending order and return None.\n"
|
|
|
|
"\n"
|
|
|
|
"The sort is in-place (i.e. the list itself is modified) and stable (i.e. the\n"
|
|
|
|
"order of two equal elements is maintained).\n"
|
|
|
|
"\n"
|
|
|
|
"If a key function is given, apply it once to each list item and sort them,\n"
|
|
|
|
"ascending or descending, according to their function values.\n"
|
|
|
|
"\n"
|
|
|
|
"The reverse flag can be set to sort in descending order.");
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
#define LIST_SORT_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"sort", _PyCFunction_CAST(list_sort), METH_FASTCALL|METH_KEYWORDS, list_sort__doc__},
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-12-15 07:11:11 -04:00
|
|
|
list_sort(PyListObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
2017-03-11 03:19:20 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2022-08-13 07:09:40 -03:00
|
|
|
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
2022-08-11 18:25:49 -03:00
|
|
|
|
2022-08-13 07:09:40 -03:00
|
|
|
#define NUM_KEYWORDS 2
|
2022-08-11 18:25:49 -03:00
|
|
|
static struct {
|
|
|
|
PyGC_Head _this_is_not_used;
|
|
|
|
PyObject_VAR_HEAD
|
|
|
|
PyObject *ob_item[NUM_KEYWORDS];
|
|
|
|
} _kwtuple = {
|
|
|
|
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
|
|
|
.ob_item = { &_Py_ID(key), &_Py_ID(reverse), },
|
|
|
|
};
|
|
|
|
#undef NUM_KEYWORDS
|
2022-08-13 07:09:40 -03:00
|
|
|
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
|
|
|
|
|
|
|
#else // !Py_BUILD_CORE
|
|
|
|
# define KWTUPLE NULL
|
|
|
|
#endif // !Py_BUILD_CORE
|
2022-08-11 18:25:49 -03:00
|
|
|
|
2017-03-11 03:19:20 -04:00
|
|
|
static const char * const _keywords[] = {"key", "reverse", NULL};
|
2022-08-11 18:25:49 -03:00
|
|
|
static _PyArg_Parser _parser = {
|
|
|
|
.keywords = _keywords,
|
|
|
|
.fname = "sort",
|
|
|
|
.kwtuple = KWTUPLE,
|
|
|
|
};
|
|
|
|
#undef KWTUPLE
|
2019-03-14 05:32:22 -03:00
|
|
|
PyObject *argsbuf[2];
|
|
|
|
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
2017-03-11 03:19:20 -04:00
|
|
|
PyObject *keyfunc = Py_None;
|
|
|
|
int reverse = 0;
|
|
|
|
|
2019-03-14 05:32:22 -03:00
|
|
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
|
|
|
|
if (!args) {
|
2017-03-11 03:19:20 -04:00
|
|
|
goto exit;
|
|
|
|
}
|
2019-03-14 05:32:22 -03:00
|
|
|
if (!noptargs) {
|
|
|
|
goto skip_optional_kwonly;
|
|
|
|
}
|
|
|
|
if (args[0]) {
|
|
|
|
keyfunc = args[0];
|
|
|
|
if (!--noptargs) {
|
|
|
|
goto skip_optional_kwonly;
|
|
|
|
}
|
|
|
|
}
|
2022-12-03 15:52:21 -04:00
|
|
|
reverse = PyObject_IsTrue(args[1]);
|
|
|
|
if (reverse < 0) {
|
2019-03-14 05:32:22 -03:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
skip_optional_kwonly:
|
2024-03-09 20:45:42 -04:00
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
2017-03-11 03:19:20 -04:00
|
|
|
return_value = list_sort_impl(self, keyfunc, reverse);
|
2024-03-09 20:45:42 -04:00
|
|
|
Py_END_CRITICAL_SECTION();
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list_reverse__doc__,
|
|
|
|
"reverse($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Reverse *IN PLACE*.");
|
|
|
|
|
|
|
|
#define LIST_REVERSE_METHODDEF \
|
|
|
|
{"reverse", (PyCFunction)list_reverse, METH_NOARGS, list_reverse__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_reverse_impl(PyListObject *self);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_reverse(PyListObject *self, PyObject *Py_UNUSED(ignored))
|
|
|
|
{
|
2024-01-08 20:00:55 -04:00
|
|
|
PyObject *return_value = NULL;
|
|
|
|
|
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
|
|
|
return_value = list_reverse_impl(self);
|
|
|
|
Py_END_CRITICAL_SECTION();
|
|
|
|
|
|
|
|
return return_value;
|
2017-03-11 03:19:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list_index__doc__,
|
|
|
|
"index($self, value, start=0, stop=sys.maxsize, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Return first index of value.\n"
|
|
|
|
"\n"
|
|
|
|
"Raises ValueError if the value is not present.");
|
|
|
|
|
|
|
|
#define LIST_INDEX_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"index", _PyCFunction_CAST(list_index), METH_FASTCALL, list_index__doc__},
|
2017-03-11 03:19:20 -04:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_index_impl(PyListObject *self, PyObject *value, Py_ssize_t start,
|
|
|
|
Py_ssize_t stop);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-12-15 07:11:11 -04:00
|
|
|
list_index(PyListObject *self, PyObject *const *args, Py_ssize_t nargs)
|
2017-03-11 03:19:20 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *value;
|
|
|
|
Py_ssize_t start = 0;
|
|
|
|
Py_ssize_t stop = PY_SSIZE_T_MAX;
|
|
|
|
|
2019-01-11 10:01:14 -04:00
|
|
|
if (!_PyArg_CheckPositional("index", nargs, 1, 3)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
value = args[0];
|
|
|
|
if (nargs < 2) {
|
|
|
|
goto skip_optional;
|
|
|
|
}
|
|
|
|
if (!_PyEval_SliceIndexNotNone(args[1], &start)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (nargs < 3) {
|
|
|
|
goto skip_optional;
|
|
|
|
}
|
|
|
|
if (!_PyEval_SliceIndexNotNone(args[2], &stop)) {
|
2017-03-11 03:19:20 -04:00
|
|
|
goto exit;
|
|
|
|
}
|
2019-01-11 10:01:14 -04:00
|
|
|
skip_optional:
|
2017-03-11 03:19:20 -04:00
|
|
|
return_value = list_index_impl(self, value, start, stop);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list_count__doc__,
|
|
|
|
"count($self, value, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Return number of occurrences of value.");
|
|
|
|
|
|
|
|
#define LIST_COUNT_METHODDEF \
|
|
|
|
{"count", (PyCFunction)list_count, METH_O, list_count__doc__},
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list_remove__doc__,
|
|
|
|
"remove($self, value, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Remove first occurrence of value.\n"
|
|
|
|
"\n"
|
|
|
|
"Raises ValueError if the value is not present.");
|
|
|
|
|
|
|
|
#define LIST_REMOVE_METHODDEF \
|
|
|
|
{"remove", (PyCFunction)list_remove, METH_O, list_remove__doc__},
|
|
|
|
|
2024-01-08 20:00:55 -04:00
|
|
|
static PyObject *
|
|
|
|
list_remove_impl(PyListObject *self, PyObject *value);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list_remove(PyListObject *self, PyObject *value)
|
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
|
|
|
|
Py_BEGIN_CRITICAL_SECTION(self);
|
|
|
|
return_value = list_remove_impl(self, value);
|
|
|
|
Py_END_CRITICAL_SECTION();
|
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2017-03-11 03:19:20 -04:00
|
|
|
PyDoc_STRVAR(list___init____doc__,
|
|
|
|
"list(iterable=(), /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Built-in mutable sequence.\n"
|
|
|
|
"\n"
|
|
|
|
"If no argument is given, the constructor creates a new empty list.\n"
|
|
|
|
"The argument must be an iterable if specified.");
|
|
|
|
|
|
|
|
static int
|
|
|
|
list___init___impl(PyListObject *self, PyObject *iterable);
|
|
|
|
|
|
|
|
static int
|
|
|
|
list___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|
|
|
{
|
|
|
|
int return_value = -1;
|
2023-01-31 16:42:03 -04:00
|
|
|
PyTypeObject *base_tp = &PyList_Type;
|
2017-03-11 03:19:20 -04:00
|
|
|
PyObject *iterable = NULL;
|
|
|
|
|
2023-01-31 16:42:03 -04:00
|
|
|
if ((Py_IS_TYPE(self, base_tp) ||
|
|
|
|
Py_TYPE(self)->tp_new == base_tp->tp_new) &&
|
2017-03-11 03:19:20 -04:00
|
|
|
!_PyArg_NoKeywords("list", kwargs)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2019-01-11 12:01:42 -04:00
|
|
|
if (!_PyArg_CheckPositional("list", PyTuple_GET_SIZE(args), 0, 1)) {
|
2017-03-11 03:19:20 -04:00
|
|
|
goto exit;
|
|
|
|
}
|
2019-01-11 12:01:42 -04:00
|
|
|
if (PyTuple_GET_SIZE(args) < 1) {
|
|
|
|
goto skip_optional;
|
|
|
|
}
|
|
|
|
iterable = PyTuple_GET_ITEM(args, 0);
|
|
|
|
skip_optional:
|
2017-03-11 03:19:20 -04:00
|
|
|
return_value = list___init___impl((PyListObject *)self, iterable);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list___sizeof____doc__,
|
|
|
|
"__sizeof__($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Return the size of the list in memory, in bytes.");
|
|
|
|
|
|
|
|
#define LIST___SIZEOF___METHODDEF \
|
|
|
|
{"__sizeof__", (PyCFunction)list___sizeof__, METH_NOARGS, list___sizeof____doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list___sizeof___impl(PyListObject *self);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list___sizeof__(PyListObject *self, PyObject *Py_UNUSED(ignored))
|
|
|
|
{
|
|
|
|
return list___sizeof___impl(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(list___reversed____doc__,
|
|
|
|
"__reversed__($self, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Return a reverse iterator over the list.");
|
|
|
|
|
|
|
|
#define LIST___REVERSED___METHODDEF \
|
|
|
|
{"__reversed__", (PyCFunction)list___reversed__, METH_NOARGS, list___reversed____doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list___reversed___impl(PyListObject *self);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored))
|
|
|
|
{
|
|
|
|
return list___reversed___impl(self);
|
|
|
|
}
|
2024-03-12 19:28:23 -03:00
|
|
|
/*[clinic end generated code: output=854957a1d4a89bbd input=a9049054013a1b77]*/
|