gh-116604: Correctly honor the gc status when calling _Py_RunGC (#116628)

This commit is contained in:
Pablo Galindo Salgado 2024-03-12 12:00:49 +00:00 committed by GitHub
parent eb947cdc13
commit 02918aa961
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 0 deletions

View file

@ -1805,6 +1805,10 @@ _PyObject_GC_Link(PyObject *op)
void
_Py_RunGC(PyThreadState *tstate)
{
GCState *gcstate = get_gc_state();
if (!gcstate->enabled) {
return;
}
gc_collect_main(tstate, GENERATION_AUTO, _Py_GC_REASON_HEAP);
}