Skip to content

Commit 278059b

Browse files
committed
Make sure tuples are untracked and avoid quadratic time validation
1 parent 595b14c commit 278059b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Python/gc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,6 @@ visit_add_to_container(PyObject *op, void *arg)
13771377
static Py_ssize_t
13781378
expand_region_transitively_reachable(PyGC_Head *container, PyGC_Head *gc, GCState *gcstate)
13791379
{
1380-
validate_list(container, collecting_clear_unreachable_clear);
13811380
struct container_and_flag arg = {
13821381
.container = container,
13831382
.visited_space = gcstate->visited_space,
@@ -1592,6 +1591,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
15921591
GCState *gcstate = &tstate->interp->gc;
15931592

15941593
gcstate->work_to_do += assess_work_to_do(gcstate);
1594+
untrack_tuples(&gcstate->young.head);
15951595
if (gcstate->phase == GC_PHASE_MARK) {
15961596
Py_ssize_t objects_marked = mark_at_start(tstate);
15971597
GC_STAT_ADD(1, objects_transitively_reachable, objects_marked);
@@ -1606,7 +1606,6 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
16061606
GC_STAT_ADD(1, objects_transitively_reachable, objects_marked);
16071607
gcstate->work_to_do -= objects_marked;
16081608
gc_list_set_space(&gcstate->young.head, gcstate->visited_space);
1609-
untrack_tuples(&gcstate->young.head);
16101609
gc_list_merge(&gcstate->young.head, &increment);
16111610
gc_list_validate_space(&increment, gcstate->visited_space);
16121611
Py_ssize_t increment_size = 0;

0 commit comments

Comments
 (0)