Skip to content

Commit

Permalink
Merge branch '3.x' into 8084_KeyError_for_broken_class
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Aug 10, 2020
2 parents f7431b9 + e4a55cb commit 24f690c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -37,6 +37,7 @@ Features added
Bugs fixed
----------

* #8074: napoleon: Crashes during processing C-ext module
* #8084: autodoc: KeyError is raised on documenting an attribute of the broken
class

Expand Down
5 changes: 4 additions & 1 deletion sphinx/ext/napoleon/docstring.py
Expand Up @@ -1074,7 +1074,10 @@ def __init__(self, docstring: Union[str, List[str]], config: SphinxConfig = None
super().__init__(docstring, config, app, what, name, obj, options)

def _get_location(self) -> str:
filepath = inspect.getfile(self._obj) if self._obj is not None else None
try:
filepath = inspect.getfile(self._obj) if self._obj is not None else None
except TypeError:
filepath = None
name = self._name

if filepath is None and name is None:
Expand Down
7 changes: 7 additions & 0 deletions sphinx/registry.py
Expand Up @@ -367,7 +367,14 @@ def add_js_file(self, filename: str, **attributes: str) -> None:
logger.debug('[app] adding js_file: %r, %r', filename, attributes)
self.js_files.append((filename, attributes))

def has_latex_package(self, name: str) -> bool:
packages = self.latex_packages + self.latex_packages_after_hyperref
return bool([x for x in packages if x[0] == name])

def add_latex_package(self, name: str, options: str, after_hyperref: bool = False) -> None:
if self.has_latex_package(name):
logger.warn("latex package '%s' already included" % name)

logger.debug('[app] adding latex package: %r', name)
if after_hyperref:
self.latex_packages_after_hyperref.append((name, options))
Expand Down
2 changes: 2 additions & 0 deletions sphinx/util/template.py
Expand Up @@ -84,6 +84,8 @@ def __init__(self, template_path: str = None, latex_engine: str = None) -> None:
self.env.variable_end_string = '%>'
self.env.block_start_string = '<%'
self.env.block_end_string = '%>'
self.env.comment_start_string = '<#'
self.env.comment_end_string = '<#'


class ReSTRenderer(SphinxRenderer):
Expand Down

0 comments on commit 24f690c

Please sign in to comment.