Skip to content

Commit

Permalink
Merge pull request #7158 from tk0miya/7151_env.indexentries_setter
Browse files Browse the repository at this point in the history
Fix #7151: crashed when extension assigns a value to env.indexentries
  • Loading branch information
tk0miya committed Feb 16, 2020
2 parents 301a7e7 + a71c682 commit 9f23744
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Bugs fixed
as a value
* #7156: autodoc: separator for keyword only arguments is not shown
* #7146: autodoc: IndexError is raised on suppressed type_comment found
* #7151: crashed when extension assigns a value to ``env.indexentries``

Testing
--------
Expand Down
8 changes: 8 additions & 0 deletions sphinx/environment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,14 @@ def indexentries(self) -> Dict[str, List[Tuple[str, str, str, str, str]]]:
domain = cast(IndexDomain, self.get_domain('index'))
return domain.entries

@indexentries.setter
def indexentries(self, entries: Dict[str, List[Tuple[str, str, str, str, str]]]) -> None:
warnings.warn('env.indexentries() is deprecated. Please use IndexDomain instead.',
RemovedInSphinx40Warning, stacklevel=2)
from sphinx.domains.index import IndexDomain
domain = cast(IndexDomain, self.get_domain('index'))
domain.data['entries'] = entries


from sphinx.errors import NoUri # NOQA

Expand Down

0 comments on commit 9f23744

Please sign in to comment.