#define FUNC_MAX_WATCHERS 8
-struct _py_func_runtime_state {
+struct _py_func_state {
uint32_t next_version;
};
struct _Py_float_state float_state;
struct _Py_long_state long_state;
struct _dtoa_state dtoa;
+ struct _py_func_state func_state;
/* Using a cache is very effective since typically only a single slice is
created and then deleted again. */
PySliceObject *slice_cache;
#include "pycore_dict_state.h" // struct _Py_dict_runtime_state
#include "pycore_floatobject.h" // struct _Py_float_runtime_state
#include "pycore_faulthandler.h" // struct _faulthandler_runtime_state
-#include "pycore_function.h" // struct _func_runtime_state
#include "pycore_global_objects.h" // struct _Py_global_objects
#include "pycore_import.h" // struct _import_runtime_state
#include "pycore_interp.h" // PyInterpreterState
struct _Py_float_runtime_state float_state;
struct _Py_unicode_runtime_state unicode_state;
struct _Py_dict_runtime_state dict_state;
- struct _py_func_runtime_state func_state;
struct {
/* Used to set PyTypeObject.tp_version_tag */
.dict_state = { \
.next_keys_version = 2, \
}, \
- .func_state = { \
- .next_version = 1, \
- }, \
.types = { \
.next_version_tag = 1, \
}, \
}, \
}, \
.dtoa = _dtoa_state_INIT(&(INTERP)), \
+ .func_state = { \
+ .next_version = 1, \
+ }, \
.static_objects = { \
.singletons = { \
._not_used = 1, \
if (func->vectorcall != _PyFunction_Vectorcall) {
return 0;
}
- if (_PyRuntime.func_state.next_version == 0) {
+ PyInterpreterState *interp = _PyInterpreterState_GET();
+ if (interp->func_state.next_version == 0) {
return 0;
}
- uint32_t v = _PyRuntime.func_state.next_version++;
+ uint32_t v = interp->func_state.next_version++;
func->func_version = v;
return v;
}