@@ -1253,17 +1253,16 @@ finalize_interp_clear(PyThreadState *tstate) |
|
|
1253 |
1253 |
{ |
1254 |
1254 |
int is_main_interp = _Py_IsMainInterpreter(tstate); |
1255 |
1255 |
|
1256 |
|
-/* bpo-36854: Explicitly clear the codec registry |
1257 |
|
- and trigger a GC collection */ |
1258 |
1256 |
PyInterpreterState *interp = tstate->interp; |
1259 |
|
-Py_CLEAR(interp->codec_search_path); |
1260 |
|
-Py_CLEAR(interp->codec_search_cache); |
1261 |
|
-Py_CLEAR(interp->codec_error_registry); |
1262 |
|
-_PyGC_CollectNoFail(); |
1263 |
1257 |
|
1264 |
1258 |
/* Clear interpreter state and all thread states */ |
1265 |
1259 |
PyInterpreterState_Clear(tstate->interp); |
1266 |
1260 |
|
|
1261 |
+/* Trigger a GC collection on subinterpreters*/ |
|
1262 |
+if (!is_main_interp) { |
|
1263 |
+_PyGC_CollectNoFail(); |
|
1264 |
+ } |
|
1265 |
+ |
1267 |
1266 |
finalize_interp_types(tstate, is_main_interp); |
1268 |
1267 |
|
1269 |
1268 |
if (is_main_interp) { |