@@ -2174,41 +2174,16 @@ _PyGC_DumpShutdownStats(PyInterpreterState *interp)
2174
2174
}
2175
2175
2176
2176
2177
- static void
2178
- gc_fini_untrack (PyGC_Head * list )
2179
- {
2180
- PyGC_Head * gc ;
2181
- for (gc = GC_NEXT (list ); gc != list ; gc = GC_NEXT (list )) {
2182
- PyObject * op = FROM_GC (gc );
2183
- _PyObject_GC_UNTRACK (op );
2184
- // gh-92036: If a deallocator function expect the object to be tracked
2185
- // by the GC (ex: func_dealloc()), it can crash if called on an object
2186
- // which is no longer tracked by the GC. Leak one strong reference on
2187
- // purpose so the object is never deleted and its deallocator is not
2188
- // called.
2189
- Py_INCREF (op );
2190
- }
2191
- }
2192
-
2193
-
2194
2177
void
2195
2178
_PyGC_Fini (PyInterpreterState * interp )
2196
2179
{
2197
2180
GCState * gcstate = & interp -> gc ;
2198
2181
Py_CLEAR (gcstate -> garbage );
2199
2182
Py_CLEAR (gcstate -> callbacks );
2200
2183
2201
- if (!_Py_IsMainInterpreter (interp )) {
2202
- // bpo-46070: Explicitly untrack all objects currently tracked by the
2203
- // GC. Otherwise, if an object is used later by another interpreter,
2204
- // calling PyObject_GC_UnTrack() on the object crashs if the previous
2205
- // or the next object of the PyGC_Head structure became a dangling
2206
- // pointer.
2207
- for (int i = 0 ; i < NUM_GENERATIONS ; i ++ ) {
2208
- PyGC_Head * gen = GEN_HEAD (gcstate , i );
2209
- gc_fini_untrack (gen );
2210
- }
2211
- }
2184
+ /* We expect that none of this interpreters objects are shared
2185
+ with other interpreters.
2186
+ See https://github.com/python/cpython/issues/90228. */
2212
2187
}
2213
2188
2214
2189
/* for debugging */
0 commit comments