Debian Codegraph @

Include/internal/pycore_function.h

raw
1 #ifndef Py_INTERNAL_FUNCTION_H
2 #define Py_INTERNAL_FUNCTION_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7 #ifndef Py_BUILD_CORE
8 # error "this header requires Py_BUILD_CORE define"
9 #endif
10
11 extern PyObject* _PyFunction_Vectorcall(
12 PyObject *func,
13 PyObject *const *stack,
14 size_t nargsf,
15 PyObject *kwnames);
16
17
18 #define FUNC_VERSION_UNSET 0
19 #define FUNC_VERSION_CLEARED 1
20 #define FUNC_VERSION_FIRST_VALID 2
21
22 extern PyFunctionObject* _PyFunction_FromConstructor(PyFrameConstructor *constr);
23
24 static inline int
25 _PyFunction_IsVersionValid(uint32_t version)
26 {
27 return version >= FUNC_VERSION_FIRST_VALID;
28 }
29
30 extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
31 PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
32 void _PyFunction_ClearCodeByVersion(uint32_t version);
33 PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code);
34
35 extern PyObject *_Py_set_function_type_params(
36 PyThreadState* unused, PyObject *func, PyObject *type_params);
37
38
39 /* See pycore_code.h for explanation about what "stateless" means. */
40
41 PyAPI_FUNC(int)
42 _PyFunction_VerifyStateless(PyThreadState *, PyObject *);
43
44 static inline PyObject* _PyFunction_GET_BUILTINS(PyObject *func) {
45 return _PyFunction_CAST(func)->func_builtins;
46 }
47 #define _PyFunction_GET_BUILTINS(func) _PyFunction_GET_BUILTINS(_PyObject_CAST(func))
48
49
50 /* Get the callable wrapped by a classmethod.
51 Returns a borrowed reference.
52 The caller must ensure 'cm' is a classmethod object. */
53 extern PyObject *_PyClassMethod_GetFunc(PyObject *cm);
54
55 /* Get the callable wrapped by a staticmethod.
56 Returns a borrowed reference.
57 The caller must ensure 'sm' is a staticmethod object. */
58 extern PyObject *_PyStaticMethod_GetFunc(PyObject *sm);
59
60
61 #ifdef __cplusplus
62 }
63 #endif
64 #endif /* !Py_INTERNAL_FUNCTION_H */