#include "Python.h"
#include "pycore_dict.h"
#include "pycore_long.h"
#include "pycore_modsupport.h"
#include "pycore_object.h"
#include "pycore_pyerrors.h"
static const char *
func_event_name(PyFunction_WatchEvent event) { … }
static void
notify_func_watchers(PyInterpreterState *interp, PyFunction_WatchEvent event,
PyFunctionObject *func, PyObject *new_value)
{ … }
static inline void
handle_func_event(PyFunction_WatchEvent event, PyFunctionObject *func,
PyObject *new_value)
{ … }
int
PyFunction_AddWatcher(PyFunction_WatchCallback callback)
{ … }
int
PyFunction_ClearWatcher(int watcher_id)
{ … }
PyFunctionObject *
_PyFunction_FromConstructor(PyFrameConstructor *constr)
{ … }
PyObject *
PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
{ … }
#ifndef Py_GIL_DISABLED
static inline struct _func_version_cache_item *
get_cache_item(PyInterpreterState *interp, uint32_t version)
{ … }
#endif
void
_PyFunction_SetVersion(PyFunctionObject *func, uint32_t version)
{ … }
static void
func_clear_version(PyInterpreterState *interp, PyFunctionObject *func)
{ … }
static void
_PyFunction_ClearVersion(PyFunctionObject *func)
{ … }
void
_PyFunction_ClearCodeByVersion(uint32_t version)
{ … }
PyFunctionObject *
_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code)
{ … }
uint32_t
_PyFunction_GetVersionForCurrentState(PyFunctionObject *func)
{ … }
PyObject *
PyFunction_New(PyObject *code, PyObject *globals)
{ … }
PyObject *
PyFunction_GetCode(PyObject *op)
{ … }
PyObject *
PyFunction_GetGlobals(PyObject *op)
{ … }
PyObject *
PyFunction_GetModule(PyObject *op)
{ … }
PyObject *
PyFunction_GetDefaults(PyObject *op)
{ … }
int
PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
{ … }
void
PyFunction_SetVectorcall(PyFunctionObject *func, vectorcallfunc vectorcall)
{ … }
PyObject *
PyFunction_GetKwDefaults(PyObject *op)
{ … }
int
PyFunction_SetKwDefaults(PyObject *op, PyObject *defaults)
{ … }
PyObject *
PyFunction_GetClosure(PyObject *op)
{ … }
int
PyFunction_SetClosure(PyObject *op, PyObject *closure)
{ … }
static PyObject *
func_get_annotation_dict(PyFunctionObject *op)
{ … }
PyObject *
PyFunction_GetAnnotations(PyObject *op)
{ … }
int
PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)
{ … }
#define OFF(x) …
static PyMemberDef func_memberlist[] = …;
static PyObject *
func_get_code(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_code(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
func_get_name(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_name(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
func_get_qualname(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_qualname(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
func_get_defaults(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_defaults(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
func_get_kwdefaults(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_kwdefaults(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
func_get_annotate(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_annotate(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
func_get_annotations(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_annotations(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
func_get_type_params(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
func_set_type_params(PyObject *self, PyObject *value, void *Py_UNUSED(ignored))
{ … }
PyObject *
_Py_set_function_type_params(PyThreadState *Py_UNUSED(ignored), PyObject *func,
PyObject *type_params)
{ … }
static PyGetSetDef func_getsetlist[] = …;
#include "clinic/funcobject.c.h"
static PyObject *
func_new_impl(PyTypeObject *type, PyCodeObject *code, PyObject *globals,
PyObject *name, PyObject *defaults, PyObject *closure,
PyObject *kwdefaults)
{ … }
static int
func_clear(PyObject *self)
{ … }
static void
func_dealloc(PyObject *self)
{ … }
static PyObject*
func_repr(PyObject *self)
{ … }
static int
func_traverse(PyObject *self, visitproc visit, void *arg)
{ … }
static PyObject *
func_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{ … }
PyTypeObject PyFunction_Type = …;
static int
functools_copy_attr(PyObject *wrapper, PyObject *wrapped, PyObject *name)
{ … }
static int
functools_wraps(PyObject *wrapper, PyObject *wrapped)
{ … }
static PyObject *
descriptor_get_wrapped_attribute(PyObject *wrapped, PyObject *obj, PyObject *name)
{ … }
static int
descriptor_set_wrapped_attribute(PyObject *oobj, PyObject *name, PyObject *value,
char *type_name)
{ … }
classmethod;
#define _PyClassMethod_CAST(cm) …
static void
cm_dealloc(PyObject *self)
{ … }
static int
cm_traverse(PyObject *self, visitproc visit, void *arg)
{ … }
static int
cm_clear(PyObject *self)
{ … }
static PyObject *
cm_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{ … }
static int
cm_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyMemberDef cm_memberlist[] = …;
static PyObject *
cm_get___isabstractmethod__(PyObject *self, void *closure)
{ … }
static PyObject *
cm_get___annotations__(PyObject *self, void *closure)
{ … }
static int
cm_set___annotations__(PyObject *self, PyObject *value, void *closure)
{ … }
static PyObject *
cm_get___annotate__(PyObject *self, void *closure)
{ … }
static int
cm_set___annotate__(PyObject *self, PyObject *value, void *closure)
{ … }
static PyGetSetDef cm_getsetlist[] = …;
static PyObject*
cm_repr(PyObject *self)
{ … }
PyDoc_STRVAR(classmethod_doc,
"classmethod(function, /)\n\
--\n\
\n\
Convert a function to be a class method.\n\
\n\
A class method receives the class as implicit first argument,\n\
just like an instance method receives the instance.\n\
To declare a class method, use this idiom:\n\
\n\
class C:\n\
@classmethod\n\
def f(cls, arg1, arg2, argN):\n\
...\n\
\n\
It can be called either on the class (e.g. C.f()) or on an instance\n\
(e.g. C().f()). The instance is ignored except for its class.\n\
If a class method is called for a derived class, the derived class\n\
object is passed as the implied first argument.\n\
\n\
Class methods are different than C++ or Java static methods.\n\
If you want those, see the staticmethod builtin.");
PyTypeObject PyClassMethod_Type = …;
PyObject *
PyClassMethod_New(PyObject *callable)
{ … }
staticmethod;
#define _PyStaticMethod_CAST(cm) …
static void
sm_dealloc(PyObject *self)
{ … }
static int
sm_traverse(PyObject *self, visitproc visit, void *arg)
{ … }
static int
sm_clear(PyObject *self)
{ … }
static PyObject *
sm_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{ … }
static int
sm_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject*
sm_call(PyObject *callable, PyObject *args, PyObject *kwargs)
{ … }
static PyMemberDef sm_memberlist[] = …;
static PyObject *
sm_get___isabstractmethod__(PyObject *self, void *closure)
{ … }
static PyObject *
sm_get___annotations__(PyObject *self, void *closure)
{ … }
static int
sm_set___annotations__(PyObject *self, PyObject *value, void *closure)
{ … }
static PyObject *
sm_get___annotate__(PyObject *self, void *closure)
{ … }
static int
sm_set___annotate__(PyObject *self, PyObject *value, void *closure)
{ … }
static PyGetSetDef sm_getsetlist[] = …;
static PyObject*
sm_repr(PyObject *self)
{ … }
PyDoc_STRVAR(staticmethod_doc,
"staticmethod(function, /)\n\
--\n\
\n\
Convert a function to be a static method.\n\
\n\
A static method does not receive an implicit first argument.\n\
To declare a static method, use this idiom:\n\
\n\
class C:\n\
@staticmethod\n\
def f(arg1, arg2, argN):\n\
...\n\
\n\
It can be called either on the class (e.g. C.f()) or on an instance\n\
(e.g. C().f()). Both the class and the instance are ignored, and\n\
neither is passed implicitly as the first argument to the method.\n\
\n\
Static methods in Python are similar to those found in Java or C++.\n\
For a more advanced concept, see the classmethod builtin.");
PyTypeObject PyStaticMethod_Type = …;
PyObject *
PyStaticMethod_New(PyObject *callable)
{ … }