Skip to content

Commit

Permalink
Fix sphinx-doc#10596: Build failure if Docutils version is 0.18 (not …
Browse files Browse the repository at this point in the history
…0.18.1)

Node.findall() was added only at Docutils 0.18.1
  • Loading branch information
jfbu committed Jun 25, 2022
1 parent 949984c commit b5aef2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Expand Up @@ -16,6 +16,9 @@ Features added
Bugs fixed
----------

* #10596: Build failure if Docutils version is 0.18 (not 0.18.1) due
to missing ``Node.findall()``

Testing
--------

Expand Down
4 changes: 2 additions & 2 deletions sphinx/util/docutils.py
Expand Up @@ -550,9 +550,9 @@ def unknown_visit(self, node: Node) -> None:


# Node.findall() is a new interface to traverse a doctree since docutils-0.18.
# This applies a patch docutils-0.17 or older to be available Node.findall()
# This applies a patch to docutils up to 0.18 inclusive to provide Node.findall()
# method to use it from our codebase.
if docutils.__version_info__ < (0, 18):
if docutils.__version_info__ <= (0, 18):
def findall(self, *args, **kwargs):
return iter(self.traverse(*args, **kwargs))

Expand Down

0 comments on commit b5aef2c

Please sign in to comment.