From 24ab40cca60c1b2ad6af96a0dd175ee4c82f9731 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Fri, 1 Jan 2021 16:19:23 +0100 Subject: [PATCH] BUG: fix an incomplete check in `Reader._error_location` It's unclear why `self._obj` can be None, but that's what I'm seeing when trying numpydoc master to build SciPy master. This fix gives the right traceback. --- numpydoc/docscrape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)