File tree 3 files changed +7
-8
lines changed
3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 286
286
_PyType_Fini (PyThreadState * tstate )
287
287
{
288
288
_PyType_ClearCache (& tstate -> interp -> type_cache );
289
- clear_slotdefs ();
289
+ if (_Py_IsMainInterpreter (tstate )) {
290
+ clear_slotdefs ();
291
+ }
290
292
}
291
293
292
294
Original file line number Diff line number Diff line change @@ -2359,10 +2359,9 @@ _PyUnicode_FromId(_Py_Identifier *id)
2359
2359
2360
2360
2361
2361
static void
2362
- unicode_clear_identifiers (PyThreadState * tstate )
2362
+ unicode_clear_identifiers (struct _Py_unicode_state * state )
2363
2363
{
2364
- PyInterpreterState * interp = _PyInterpreterState_GET ();
2365
- struct _Py_unicode_ids * ids = & interp -> unicode .ids ;
2364
+ struct _Py_unicode_ids * ids = & state -> ids ;
2366
2365
for (Py_ssize_t i = 0 ; i < ids -> size ; i ++ ) {
2367
2366
Py_XDECREF (ids -> array [i ]);
2368
2367
}
@@ -16243,7 +16242,7 @@ _PyUnicode_Fini(PyThreadState *tstate)
16243
16242
16244
16243
_PyUnicode_FiniEncodings (& state -> fs_codec );
16245
16244
16246
- unicode_clear_identifiers (tstate );
16245
+ unicode_clear_identifiers (state );
16247
16246
16248
16247
for (Py_ssize_t i = 0 ; i < 256 ; i ++ ) {
16249
16248
Py_CLEAR (state -> latin1 [i ]);
Original file line number Diff line number Diff line change @@ -1573,6 +1573,7 @@ finalize_interp_types(PyThreadState *tstate)
1573
1573
_PyFrame_Fini (tstate );
1574
1574
_PyAsyncGen_Fini (tstate );
1575
1575
_PyContext_Fini (tstate );
1576
+ _PyType_Fini (tstate );
1576
1577
// Call _PyUnicode_ClearInterned() before _PyDict_Fini() since it uses
1577
1578
// a dict internally.
1578
1579
_PyUnicode_ClearInterned (tstate );
@@ -1751,9 +1752,6 @@ Py_FinalizeEx(void)
1751
1752
/* Destroy the database used by _PyImport_{Fixup,Find}Extension */
1752
1753
_PyImport_Fini ();
1753
1754
1754
- /* Cleanup typeobject.c's internal caches. */
1755
- _PyType_Fini (tstate );
1756
-
1757
1755
/* unload faulthandler module */
1758
1756
_PyFaulthandler_Fini ();
1759
1757
You can’t perform that action at this time.
0 commit comments