aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/gc_free_threading.c
diff options
context:
space:
mode:
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>2024-11-19 11:25:09 +0200
committerGitHub <noreply@github.com>2024-11-19 11:25:09 +0200
commit899fdb213db6c5881c5f9c6760ead6fd713d2070 (patch)
treec4e291504c73e8055d02176551beeb39ab47e6ad /Python/gc_free_threading.c
parent84f07c3a4cbcfe488ccfb4030571be0bc4de7e45 (diff)
downloadcpython-899fdb213db6c5881c5f9c6760ead6fd713d2070.tar.gz
cpython-899fdb213db6c5881c5f9c6760ead6fd713d2070.zip
Revert "GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-126502)" (#126983)
Diffstat (limited to 'Python/gc_free_threading.c')
-rw-r--r--Python/gc_free_threading.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c
index a6e0022340b..499ee51fdb2 100644
--- a/Python/gc_free_threading.c
+++ b/Python/gc_free_threading.c
@@ -3,7 +3,7 @@
#include "pycore_brc.h" // struct _brc_thread_state
#include "pycore_ceval.h" // _Py_set_eval_breaker_bit()
#include "pycore_context.h"
-#include "pycore_dict.h" // _PyInlineValuesSize()
+#include "pycore_dict.h" // _PyDict_MaybeUntrack()
#include "pycore_freelist.h" // _PyObject_ClearFreeLists()
#include "pycore_initconfig.h"
#include "pycore_interp.h" // PyInterpreterState.gc
@@ -493,6 +493,13 @@ update_refs(const mi_heap_t *heap, const mi_heap_area_t *area,
return true;
}
}
+ else if (PyDict_CheckExact(op)) {
+ _PyDict_MaybeUntrack(op);
+ if (!_PyObject_GC_IS_TRACKED(op)) {
+ gc_restore_refs(op);
+ return true;
+ }
+ }
}
// We repurpose ob_tid to compute "gc_refs", the number of external