From 7d844158a890696208a9f1dfb878d69e50aebaf5 Mon Sep 17 00:00:00 2001 From: Matthew Woodcraft Date: Mon, 23 Oct 2023 21:19:51 +0100 Subject: [PATCH] fix RubricCollector.clear_doc() --- exts/ferrocene_spec/items_with_rubric.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/exts/ferrocene_spec/items_with_rubric.py b/exts/ferrocene_spec/items_with_rubric.py index 2731af1a..9b451d75 100644 --- a/exts/ferrocene_spec/items_with_rubric.py +++ b/exts/ferrocene_spec/items_with_rubric.py @@ -40,11 +40,7 @@ class RubricCollector(EnvironmentCollector): def clear_doc(self, app, env, docname): storage = get_storage(env) for rubric, items in storage.items(): - # This makes a copy of the list (with `list(items)`) to be able to - # remove items from it without affecting the iteration. - for i, item in enumerate(list(items)): - if item.document == docname: - items.pop(i) + items[:] = (item for item in items if item.document != docname) def merge_other(self, app, env, docnames, other): current = get_storage(env)