diff --git a/sphinx_needs/directives/need.py b/sphinx_needs/directives/need.py index 1126e6288..a92be651e 100644 --- a/sphinx_needs/directives/need.py +++ b/sphinx_needs/directives/need.py @@ -406,7 +406,7 @@ def process_need_nodes(app: Sphinx, doctree: nodes.document, fromdocname: str) - post_process_needs_data(app) - for extend_node in doctree.findall(Needextend): + for extend_node in list(doctree.findall(Needextend)): remove_node_from_tree(extend_node) format_need_nodes(app, doctree, fromdocname, list(doctree.findall(Need)))