File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -343,7 +343,8 @@ struct internals {
343343 // completely shut down, In that case, we should not decref these objects because pymalloc
344344 // is gone. This also applies across sub-interpreters, we should only DECREF when the
345345 // original owning interpreter is active.
346- if (get_interpreter_state_unchecked () == istate) {
346+ auto *cur_istate = get_interpreter_state_unchecked ();
347+ if (cur_istate && cur_istate == istate) {
347348 Py_CLEAR (instance_base);
348349 Py_CLEAR (default_metaclass);
349350 Py_CLEAR (static_property_type);
@@ -375,7 +376,8 @@ struct local_internals {
375376 // completely shut down, In that case, we should not decref these objects because pymalloc
376377 // is gone. This also applies across sub-interpreters, we should only DECREF when the
377378 // original owning interpreter is active.
378- if (get_interpreter_state_unchecked () == istate) {
379+ auto *cur_istate = get_interpreter_state_unchecked ();
380+ if (cur_istate && cur_istate == istate) {
379381 Py_CLEAR (function_record_py_type);
380382 }
381383 }
You can’t perform that action at this time.
0 commit comments