2021-11-23 05:53:24 -04:00
|
|
|
#ifndef Py_INTERNAL_FUNCTION_H
|
|
|
|
#define Py_INTERNAL_FUNCTION_H
|
2022-02-25 11:07:14 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2021-11-23 05:53:24 -04:00
|
|
|
|
2022-02-25 11:07:14 -04:00
|
|
|
#ifndef Py_BUILD_CORE
|
|
|
|
# error "this header requires Py_BUILD_CORE define"
|
|
|
|
#endif
|
2021-11-23 05:53:24 -04:00
|
|
|
|
2023-07-22 18:44:33 -03:00
|
|
|
extern PyObject* _PyFunction_Vectorcall(
|
|
|
|
PyObject *func,
|
|
|
|
PyObject *const *stack,
|
|
|
|
size_t nargsf,
|
|
|
|
PyObject *kwnames);
|
|
|
|
|
2022-11-22 08:06:44 -04:00
|
|
|
#define FUNC_MAX_WATCHERS 8
|
|
|
|
|
2023-08-17 15:29:58 -03:00
|
|
|
#define FUNC_VERSION_CACHE_SIZE (1<<12) /* Must be a power of 2 */
|
2023-03-08 18:56:36 -04:00
|
|
|
struct _py_func_state {
|
2022-11-16 13:37:29 -04:00
|
|
|
uint32_t next_version;
|
2023-08-17 15:29:58 -03:00
|
|
|
// Borrowed references to function objects whose
|
|
|
|
// func_version % FUNC_VERSION_CACHE_SIZE
|
|
|
|
// once was equal to the index in the table.
|
|
|
|
// They are cleared when the function is deallocated.
|
|
|
|
PyFunctionObject *func_version_cache[FUNC_VERSION_CACHE_SIZE];
|
2022-11-16 13:37:29 -04:00
|
|
|
};
|
|
|
|
|
2022-02-25 11:07:14 -04:00
|
|
|
extern PyFunctionObject* _PyFunction_FromConstructor(PyFrameConstructor *constr);
|
2021-11-23 05:53:24 -04:00
|
|
|
|
2022-02-25 11:07:14 -04:00
|
|
|
extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
|
2024-02-29 12:11:28 -04:00
|
|
|
PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
|
2023-08-17 15:29:58 -03:00
|
|
|
PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version);
|
|
|
|
|
2023-05-16 00:36:23 -03:00
|
|
|
extern PyObject *_Py_set_function_type_params(
|
|
|
|
PyThreadState* unused, PyObject *func, PyObject *type_params);
|
2021-11-23 05:53:24 -04:00
|
|
|
|
2022-02-25 11:07:14 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2021-11-23 05:53:24 -04:00
|
|
|
#endif /* !Py_INTERNAL_FUNCTION_H */
|