summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-07-31 00:34:29 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-07-31 00:34:29 -0700
commit0e5864c9ecf8a5691ebf6032ba920126b6103c3e (patch)
tree3c41526489c6a9fe8bda9da56267ed6b7b1130f1
parent083aedba2f49e1b490d3e122f5927f0718cf202c (diff)
downloadnumpy-0e5864c9ecf8a5691ebf6032ba920126b6103c3e.tar.gz
BUG: Fix doc source links to unwrap decorators
Fixes #11639, relates to https://bugs.python.org/issue1764286
-rw-r--r--doc/source/conf.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 93a5ea01e..455e9748b 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -321,6 +321,15 @@ def linkcode_resolve(domain, info):
except Exception:
return None
+ # strip decorators, which would resolve to the source of the decorator
+ # possibly an upstream bug in getsourcefile, bpo-1764286
+ try:
+ unwrap = inspect.unwrap
+ except AttributeError:
+ pass
+ else:
+ obj = unwrap(obj)
+
try:
fn = inspect.getsourcefile(obj)
except Exception: