#include "Python.h"
#include "pycore_call.h"
#include "pycore_dict.h"
#include "pycore_long.h"
#include "pycore_moduleobject.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_tuple.h"
#include "clinic/_functoolsmodule.c.h"
_functools_state;
static inline _functools_state *
get_functools_state(PyObject *module)
{ … }
partialobject;
static void partial_setvectorcall(partialobject *pto);
static struct PyModuleDef _functools_module;
static PyObject *
partial_call(partialobject *pto, PyObject *args, PyObject *kwargs);
static inline _functools_state *
get_functools_state_by_type(PyTypeObject *type)
{ … }
static PyObject *
partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
{ … }
static int
partial_clear(partialobject *pto)
{ … }
static int
partial_traverse(partialobject *pto, visitproc visit, void *arg)
{ … }
static void
partial_dealloc(partialobject *pto)
{ … }
static PyObject *
partial_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{ … }
Py_NO_INLINE static PyObject *
partial_vectorcall_fallback(PyThreadState *tstate, partialobject *pto,
PyObject *const *args, size_t nargsf,
PyObject *kwnames)
{ … }
static PyObject *
partial_vectorcall(partialobject *pto, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{ … }
static void
partial_setvectorcall(partialobject *pto)
{ … }
static PyObject *
partial_call(partialobject *pto, PyObject *args, PyObject *kwargs)
{ … }
PyDoc_STRVAR(partial_doc,
"partial(func, /, *args, **keywords)\n--\n\n\
Create a new function with partial application of the given arguments\n\
and keywords.");
#define OFF(x) …
static PyMemberDef partial_memberlist[] = …;
static PyGetSetDef partial_getsetlist[] = …;
static PyObject *
partial_repr(partialobject *pto)
{ … }
static PyObject *
partial_reduce(partialobject *pto, PyObject *unused)
{ … }
static PyObject *
partial_setstate(partialobject *pto, PyObject *state)
{ … }
static PyMethodDef partial_methods[] = …;
static PyType_Slot partial_type_slots[] = …;
static PyType_Spec partial_type_spec = …;
keyobject;
static int
keyobject_clear(keyobject *ko)
{ … }
static void
keyobject_dealloc(keyobject *ko)
{ … }
static int
keyobject_traverse(keyobject *ko, visitproc visit, void *arg)
{ … }
static PyMemberDef keyobject_members[] = …;
static PyObject *
keyobject_text_signature(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static PyGetSetDef keyobject_getset[] = …;
static PyObject *
keyobject_call(keyobject *ko, PyObject *args, PyObject *kwds);
static PyObject *
keyobject_richcompare(PyObject *ko, PyObject *other, int op);
static PyType_Slot keyobject_type_slots[] = …;
static PyType_Spec keyobject_type_spec = …;
static PyObject *
keyobject_call(keyobject *ko, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
keyobject_richcompare(PyObject *ko, PyObject *other, int op)
{ … }
static PyObject *
_functools_cmp_to_key_impl(PyObject *module, PyObject *mycmp)
{ … }
static PyObject *
functools_reduce(PyObject *self, PyObject *args)
{ … }
PyDoc_STRVAR(functools_reduce_doc,
"reduce(function, iterable[, initial], /) -> value\n\
\n\
Apply a function of two arguments cumulatively to the items of a sequence\n\
or iterable, from left to right, so as to reduce the iterable to a single\n\
value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n\
((((1+2)+3)+4)+5). If initial is present, it is placed before the items\n\
of the iterable in the calculation, and serves as a default when the\n\
iterable is empty.");
struct lru_list_elem;
struct lru_cache_object;
lru_list_elem;
static void
lru_list_elem_dealloc(lru_list_elem *link)
{ … }
static PyType_Slot lru_list_elem_type_slots[] = …;
static PyType_Spec lru_list_elem_type_spec = …;
lru_cache_ternaryfunc;
lru_cache_object;
static PyObject *
lru_cache_make_key(PyObject *kwd_mark, PyObject *args,
PyObject *kwds, int typed)
{ … }
static PyObject *
uncached_lru_cache_wrapper(lru_cache_object *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
infinite_lru_cache_wrapper(lru_cache_object *self, PyObject *args, PyObject *kwds)
{ … }
static void
lru_cache_extract_link(lru_list_elem *link)
{ … }
static void
lru_cache_append_link(lru_cache_object *self, lru_list_elem *link)
{ … }
static void
lru_cache_prepend_link(lru_cache_object *self, lru_list_elem *link)
{ … }
static PyObject *
bounded_lru_cache_wrapper(lru_cache_object *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
lru_cache_new(PyTypeObject *type, PyObject *args, PyObject *kw)
{ … }
static lru_list_elem *
lru_cache_unlink_list(lru_cache_object *self)
{ … }
static void
lru_cache_clear_list(lru_list_elem *link)
{ … }
static int
lru_cache_tp_clear(lru_cache_object *self)
{ … }
static void
lru_cache_dealloc(lru_cache_object *obj)
{ … }
static PyObject *
lru_cache_call(lru_cache_object *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
lru_cache_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{ … }
static PyObject *
_functools__lru_cache_wrapper_cache_info_impl(PyObject *self)
{ … }
static PyObject *
_functools__lru_cache_wrapper_cache_clear_impl(PyObject *self)
{ … }
static PyObject *
lru_cache_reduce(PyObject *self, PyObject *unused)
{ … }
static PyObject *
lru_cache_copy(PyObject *self, PyObject *unused)
{ … }
static PyObject *
lru_cache_deepcopy(PyObject *self, PyObject *unused)
{ … }
static int
lru_cache_tp_traverse(lru_cache_object *self, visitproc visit, void *arg)
{ … }
PyDoc_STRVAR(lru_cache_doc,
"Create a cached callable that wraps another function.\n\
\n\
user_function: the function being cached\n\
\n\
maxsize: 0 for no caching\n\
None for unlimited cache size\n\
n for a bounded cache\n\
\n\
typed: False cache f(3) and f(3.0) as identical calls\n\
True cache f(3) and f(3.0) as distinct calls\n\
\n\
cache_info_type: namedtuple class with the fields:\n\
hits misses currsize maxsize\n"
);
static PyMethodDef lru_cache_methods[] = …;
static PyGetSetDef lru_cache_getsetlist[] = …;
static PyMemberDef lru_cache_memberlist[] = …;
static PyType_Slot lru_cache_type_slots[] = …;
static PyType_Spec lru_cache_type_spec = …;
PyDoc_STRVAR(_functools_doc,
"Tools that operate on functions.");
static PyMethodDef _functools_methods[] = …;
static int
_functools_exec(PyObject *module)
{ … }
static int
_functools_traverse(PyObject *module, visitproc visit, void *arg)
{ … }
static int
_functools_clear(PyObject *module)
{ … }
static void
_functools_free(void *module)
{ … }
static struct PyModuleDef_Slot _functools_slots[] = …;
static struct PyModuleDef _functools_module = …;
PyMODINIT_FUNC
PyInit__functools(void)
{ … }