[3.14] GH-148726: Add heap_size to _gc_runtime_state (#149025)

This commit is contained in:
Sergey Miryanov 2026-04-29 15:04:11 +05:00 committed by GitHub
parent 4994367796
commit 4d0ae4cba9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 366 additions and 345 deletions

View file

@ -1981,6 +1981,8 @@ PyObject_GC_Del(void *op)
PyGC_Head *g = AS_GC(op);
if (_PyObject_GC_IS_TRACKED(op)) {
gc_list_remove(g);
GCState *gcstate = get_gc_state();
gcstate->heap_size--;
#ifdef Py_DEBUG
PyObject *exc = PyErr_GetRaisedException();
if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0,