File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ struct _types_runtime_state {
2222 // bpo-42745: next_version_tag remains shared by all interpreters
2323 // because of static types.
2424 unsigned int next_version_tag ;
25- PyMutex type_mutex ;
2625};
2726
2827
@@ -71,6 +70,7 @@ struct types_state {
7170 struct type_cache type_cache ;
7271 size_t num_builtins_initialized ;
7372 static_builtin_state builtins [_Py_MAX_STATIC_BUILTIN_TYPES ];
73+ PyMutex mutex ;
7474};
7575
7676
Original file line number Diff line number Diff line change @@ -60,17 +60,18 @@ class object "PyObject *" "&PyBaseObject_Type"
6060// in odd behaviors w.r.t. running with the GIL as the outer type lock could
6161// be released and reacquired during a subclass update if there's contention
6262// on the subclass lock.
63+ #define TYPE_LOCK &PyInterpreterState_Get()->types.mutex
6364#define BEGIN_TYPE_LOCK () \
6465 { \
6566 _PyCriticalSection _cs; \
66- _PyCriticalSection_Begin(&_cs, &_PyRuntime.types.type_mutex); \
67+ _PyCriticalSection_Begin(&_cs, TYPE_LOCK); \
6768
6869#define END_TYPE_LOCK () \
6970 _PyCriticalSection_End(&_cs); \
7071 }
7172
7273#define ASSERT_TYPE_LOCK_HELD () \
73- _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(&_PyRuntime.types.type_mutex )
74+ _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(TYPE_LOCK )
7475
7576#else
7677
Original file line number Diff line number Diff line change @@ -395,7 +395,7 @@ _Py_COMP_DIAG_POP
395395 &(runtime)->atexit.mutex, \
396396 &(runtime)->audit_hooks.mutex, \
397397 &(runtime)->allocators.mutex, \
398- &(runtime)->types.type_mutex , \
398+ &(runtime)->_main_interpreter. types.mutex , \
399399 }
400400
401401static void
You can’t perform that action at this time.
0 commit comments