From 3fbf841987878b2b056c42996619e44224cc0c47 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Wed, 16 Oct 2024 10:56:28 +0200 Subject: [PATCH] tools/clean_svg: do not remove an elem while iterating on a list Doing a simple is undefined: for e in ls: if e.matches(foo): ls.remove(e) Basically we were skipping the next entry, still leaving some metadata in the cleaned up svg file. --- tools/clean_svg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/clean_svg.py b/tools/clean_svg.py index f4b7df97..612bdfc1 100755 --- a/tools/clean_svg.py +++ b/tools/clean_svg.py @@ -84,7 +84,7 @@ def round_if_number(value): def remove_non_svg_nodes_and_strip_namespace(root): if root.tag.startswith(BRACKETS_NAMESPACE): root.tag = root.tag[len(BRACKETS_NAMESPACE) :] - for elem in root: + for elem in list(root): if ( not elem.tag.startswith(BRACKETS_NAMESPACE) or elem.tag == BRACKETS_NAMESPACE + "metadata"