diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-10-26 19:49:57 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-10-26 19:49:59 +0300 |
commit | 13803a79e7179f40a27f46d5a5a05f1eebbcbb63 (patch) | |
tree | 2cb19dd2900c96c57f601d46bdfbfc0652127b13 /sphinx/ext/todo.py | |
parent | 2be9d6b092965a2f9354da66b645bf5ea76ce288 (diff) |
Support docutils-0.18: Consume iterator of Element.traverse()
Since 0.18, Element.traverse() returns an iterator instead of
intermediate object. As a result, the return value is always considered
as truthy value. And it becomes fragile when the caller modifies the
doctree on the loop.
Diffstat (limited to 'sphinx/ext/todo.py')
-rw-r--r-- | sphinx/ext/todo.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/ext/todo.py b/sphinx/ext/todo.py index 6b7c1b73b..beab0976d 100644 --- a/sphinx/ext/todo.py +++ b/sphinx/ext/todo.py @@ -131,7 +131,7 @@ class TodoListProcessor: def process(self, doctree: nodes.document, docname: str) -> None: todos: List[todo_node] = sum(self.domain.todos.values(), []) - for node in doctree.traverse(todolist): + for node in list(doctree.traverse(todolist)): if not self.config.todo_include_todos: node.parent.remove(node) continue |