summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2021-01-01 16:19:23 +0100
committerRalf Gommers <ralf.gommers@gmail.com>2021-01-01 16:19:23 +0100
commit24ab40cca60c1b2ad6af96a0dd175ee4c82f9731 (patch)
tree96d7a21a195ba90812e3dec5da5fe4ad9413538b
parent8275f4e9d32c232f66516351e69c6a09eb7f16d6 (diff)
downloadnumpydoc-24ab40cca60c1b2ad6af96a0dd175ee4c82f9731.tar.gz
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.
-rw-r--r--numpydoc/docscrape.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py
index c669ffc..15b4e10 100644
--- a/numpydoc/docscrape.py
+++ b/numpydoc/docscrape.py
@@ -412,7 +412,7 @@ class NumpyDocString(Mapping):
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)