Skip to content

Commit

Permalink
πŸ› Fix removal of Needextend nodes (#1298)
Browse files Browse the repository at this point in the history
We need to exhaust the entire `findall` iterator, before performing mutations on the doctree, otherwise this can lead to unexpected results
  • Loading branch information
chrisjsewell authored Sep 13, 2024
1 parent affe6be commit db66f57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sphinx_needs/directives/need.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit db66f57

Please sign in to comment.