File tree 5 files changed +11
-5
lines changed
5 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ extern "C" {
8
8
# error "this header requires Py_BUILD_CORE define"
9
9
#endif
10
10
11
+ struct _py_func_runtime_state {
12
+ uint32_t next_version ;
13
+ };
14
+
11
15
extern PyFunctionObject * _PyFunction_FromConstructor (PyFrameConstructor * constr );
12
16
13
17
extern uint32_t _PyFunction_GetVersionForCurrentState (PyFunctionObject * func );
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ extern "C" {
10
10
11
11
#include "pycore_atomic.h" /* _Py_atomic_address */
12
12
#include "pycore_dict_state.h" // struct _Py_dict_runtime_state
13
+ #include "pycore_function.h" // struct _func_runtime_state
13
14
#include "pycore_gil.h" // struct _gil_runtime_state
14
15
#include "pycore_global_objects.h" // struct _Py_global_objects
15
16
#include "pycore_import.h" // struct _import_runtime_state
@@ -137,6 +138,7 @@ typedef struct pyruntimestate {
137
138
138
139
struct _Py_unicode_runtime_ids unicode_ids ;
139
140
struct _Py_dict_runtime_state dict_state ;
141
+ struct _py_func_runtime_state func_state ;
140
142
141
143
struct {
142
144
/* Used to set PyTypeObject.tp_version_tag */
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ extern "C" {
39
39
.dict_state = { \
40
40
.next_keys_version = 2, \
41
41
}, \
42
+ .func_state = { \
43
+ .next_version = 1, \
44
+ }, \
42
45
.types = { \
43
46
.next_version_tag = 1, \
44
47
}, \
Original file line number Diff line number Diff line change 7
7
#include "pycore_pyerrors.h" // _PyErr_Occurred()
8
8
#include "structmember.h" // PyMemberDef
9
9
10
- static uint32_t next_func_version = 1 ;
11
-
12
10
PyFunctionObject *
13
11
_PyFunction_FromConstructor (PyFrameConstructor * constr )
14
12
{
@@ -130,10 +128,10 @@ uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func)
130
128
if (func -> vectorcall != _PyFunction_Vectorcall ) {
131
129
return 0 ;
132
130
}
133
- if (next_func_version == 0 ) {
131
+ if (_PyRuntime . func_state . next_version == 0 ) {
134
132
return 0 ;
135
133
}
136
- uint32_t v = next_func_version ++ ;
134
+ uint32_t v = _PyRuntime . func_state . next_version ++ ;
137
135
func -> func_version = v ;
138
136
return v ;
139
137
}
Original file line number Diff line number Diff line change @@ -416,7 +416,6 @@ Python/dtoa.c - pmem_next -
416
416
Python/getargs.c - static_arg_parsers -
417
417
418
418
# other
419
- Objects/funcobject.c - next_func_version -
420
419
Objects/object.c - _Py_RefTotal -
421
420
Python/perf_trampoline.c - perf_status -
422
421
Python/perf_trampoline.c - extra_code_index -
You can’t perform that action at this time.
0 commit comments