extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
void _PyFunction_ClearCodeByVersion(uint32_t version);
-PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code);
extern PyObject *_Py_set_function_type_params(
PyThreadState* unused, PyObject *func, PyObject *type_params);
#endif
}
-PyFunctionObject *
-_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code)
-{
-#ifdef Py_GIL_DISABLED
- return NULL;
-#else
- PyInterpreterState *interp = _PyInterpreterState_GET();
- struct _func_version_cache_item *slot = get_cache_item(interp, version);
- if (slot->code) {
- assert(PyCode_Check(slot->code));
- PyCodeObject *code = (PyCodeObject *)slot->code;
- if (code->co_version == version) {
- *p_code = slot->code;
- }
- }
- else {
- *p_code = NULL;
- }
- if (slot->func && slot->func->func_version == version) {
- assert(slot->func->func_code == slot->code);
- return slot->func;
- }
- return NULL;
-#endif
-}
-
uint32_t
_PyFunction_GetVersionForCurrentState(PyFunctionObject *func)
{
#include "pycore_bitutils.h" // _Py_popcount32()
#include "pycore_ceval.h" // _Py_set_eval_breaker_bit
#include "pycore_code.h" // _Py_GetBaseCodeUnit
-#include "pycore_function.h" // _PyFunction_LookupByVersion()
#include "pycore_interpframe.h"
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_opcode_metadata.h" // _PyOpcode_OpName[]