Skip to content

Commit 4f99de6

Browse files
committed
wip: fix reversion on mark_heap_visitor()
If the object is already marked as reachable, we shouldn't traverse it again.
1 parent a3089e5 commit 4f99de6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/gc_free_threading.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ mark_heap_visitor(const mi_heap_t *heap, const mi_heap_area_t *area,
917917
_PyObject_ASSERT_WITH_MSG(op, gc_get_refs(op) >= 0,
918918
"refcount is too small");
919919

920-
if (gc_get_refs(op) != 0) {
920+
if (gc_is_unreachable(op) && gc_get_refs(op) != 0) {
921921
// Object is reachable but currently marked as unreachable.
922922
// Mark it as reachable and traverse its pointers to find
923923
// any other object that may be directly reachable from it.

0 commit comments

Comments
 (0)