Skip to content

Commit

Permalink
Revert changes to env
Browse files Browse the repository at this point in the history
  • Loading branch information
ubmarco committed Nov 16, 2023
1 parent 8f32239 commit 5794f53
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions sphinx/environment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,16 +612,6 @@ def get_doctree(self, docname: str) -> nodes.document:
def master_doctree(self) -> nodes.document:
return self.get_doctree(self.config.root_doc)

def get_doctree_write(self, docname: str) -> nodes.document:
"""Read the doctree from pickle for the write phase."""
try:
doctree = self._write_doc_doctree_cache.pop(docname)
doctree.settings.env = self
doctree.reporter = LoggingReporter(self.doc2path(docname))
except KeyError:
doctree = self.get_doctree(docname)
return doctree

def get_and_resolve_doctree(
self,
docname: str,
Expand All @@ -630,9 +620,16 @@ def get_and_resolve_doctree(
prune_toctrees: bool = True,
includehidden: bool = False,
) -> nodes.document:
"""Get the doctree, resolve cross-references and toctrees and return it."""
"""Read the doctree from the pickle, resolve cross-references and
toctrees and return it.
"""
if doctree is None:
doctree = self.get_doctree_write(docname)
try:
doctree = self._write_doc_doctree_cache.pop(docname)
doctree.settings.env = self
doctree.reporter = LoggingReporter(self.doc2path(docname))
except KeyError:
doctree = self.get_doctree(docname)

# resolve all pending cross-references
self.apply_post_transforms(doctree, docname)
Expand Down

0 comments on commit 5794f53

Please sign in to comment.