Skip to content

Commit f06d2d4

Browse files
committed
Inline check
1 parent 45f639d commit f06d2d4

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎Python/gc_free_threading.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,11 +2158,10 @@ gc_collect_internal(PyInterpreterState *interp, struct collection_state *state,
21582158
// Deallocations after the refcount merge may run Python code.
21592159
bool needs_resurrection_check = state->objs_to_decref.head != 0;
21602160

2161-
bool debug_print = false;
2162-
if (FT_ATOMIC_LOAD_INT_RELAXED(interp->gc.debug) & _PyGC_DEBUG_COLLECTABLE) {
2163-
// Trigger debug print once we have exited start the world in re
2164-
debug_print = true;
2165-
}
2161+
// The debug output is written with sys.stderr.write(), which may run
2162+
// Python code, so it is printed below after the world is started.
2163+
bool debug_print = (FT_ATOMIC_LOAD_INT_RELAXED(interp->gc.debug) &
2164+
_PyGC_DEBUG_COLLECTABLE) != 0;
21662165

21672166
// Find weakref callbacks and pending finalizers (but do not call them).
21682167
bool has_finalizers = prepare_finalization(state, &needs_resurrection_check);

0 commit comments

Comments
 (0)