10000 BUG: Fix doc source links to unwrap decorators · convexset/numpy@0e5864c · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e5864c

Browse files
committed
BUG: Fix doc source links to unwrap decorators
Fixes numpy#11639, relates to https://bugs.python.org/issue1764286
1 parent 083aedb commit 0e5864c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/source/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,15 @@ def linkcode_resolve(domain, info):
321321
except Exception:
322322
return None
323323

324+
# strip decorators, which would resolve to the source of the decorator
325+
# possibly an upstream bug in getsourcefile, bpo-1764286
326+
try:
327+
unwrap = inspect.unwrap
328+
except AttributeError:
329+
pass
330+
else:
331+
obj = unwrap(obj)
332+
324333
try:
325334
fn = inspect.getsourcefile(obj)
326335
except Exception:

0 commit comments

Comments
 (0)
0