diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py index c669ffcc..15b4e10d 100644 --- a/numpydoc/docscrape.py +++ b/numpydoc/docscrape.py @@ -412,7 +412,7 @@ def _parse(self): self[section] = content def _error_location(self, msg, error=True): - if hasattr(self, '_obj'): + if hasattr(self, '_obj') and self._obj is not None: # we know where the docs came from: try: filename = inspect.getsourcefile(self._obj)