File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 286286_PyType_Fini (PyThreadState * tstate )
287287{
288288 _PyType_ClearCache (& tstate -> interp -> type_cache );
289- clear_slotdefs ();
289+ if (_Py_IsMainInterpreter (tstate )) {
290+ clear_slotdefs ();
291+ }
290292}
291293
292294
Original file line number Diff line number Diff line change @@ -2359,10 +2359,9 @@ _PyUnicode_FromId(_Py_Identifier *id)
23592359
23602360
23612361static void
2362- unicode_clear_identifiers (PyThreadState * tstate )
2362+ unicode_clear_identifiers (struct _Py_unicode_state * state )
23632363{
2364- PyInterpreterState * interp = _PyInterpreterState_GET ();
2365- struct _Py_unicode_ids * ids = & interp -> unicode .ids ;
2364+ struct _Py_unicode_ids * ids = & state -> ids ;
23662365 for (Py_ssize_t i = 0 ; i < ids -> size ; i ++ ) {
23672366 Py_XDECREF (ids -> array [i ]);
23682367 }
@@ -16243,7 +16242,7 @@ _PyUnicode_Fini(PyThreadState *tstate)
1624316242
1624416243 _PyUnicode_FiniEncodings (& state -> fs_codec );
1624516244
16246- unicode_clear_identifiers (tstate );
16245+ unicode_clear_identifiers (state );
1624716246
1624816247 for (Py_ssize_t i = 0 ; i < 256 ; i ++ ) {
1624916248 Py_CLEAR (state -> latin1 [i ]);
Original file line number Diff line number Diff line change @@ -1573,6 +1573,7 @@ finalize_interp_types(PyThreadState *tstate)
15731573 _PyFrame_Fini (tstate );
15741574 _PyAsyncGen_Fini (tstate );
15751575 _PyContext_Fini (tstate );
1576+ _PyType_Fini (tstate );
15761577 // Call _PyUnicode_ClearInterned() before _PyDict_Fini() since it uses
15771578 // a dict internally.
15781579 _PyUnicode_ClearInterned (tstate );
@@ -1751,9 +1752,6 @@ Py_FinalizeEx(void)
17511752 /* Destroy the database used by _PyImport_{Fixup,Find}Extension */
17521753 _PyImport_Fini ();
17531754
1754- /* Cleanup typeobject.c's internal caches. */
1755- _PyType_Fini (tstate );
1756-
17571755 /* unload faulthandler module */
17581756 _PyFaulthandler_Fini ();
17591757
You can’t perform that action at this time.
0 commit comments