diff --git a/CHANGES b/CHANGES index 5f645efa843..0926737463b 100644 --- a/CHANGES +++ b/CHANGES @@ -37,6 +37,8 @@ Features added Bugs fixed ---------- +* #8074: napoleon: Crashes during processing C-ext module + Testing -------- diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py index 52abf975339..29799cb06c3 100644 --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -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: