Skip to content

Commit 24d217c

Browse files
committed
Docs: Fix link to source for class properties
The property has setters and getters. Link to the getter if it's available. This adds line numbers to the source link for properties. Fixes #2401
1 parent ec262d8 commit 24d217c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/source/conf.py

+3
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ def linkcode_resolve(domain, info):
360360
else:
361361
filename = info['module'].replace('.', '/') + '.py'
362362

363+
if isinstance(val, property):
364+
val = val.fget
365+
363366
if isinstance(val, (types.ModuleType, types.MethodType, types.FunctionType, types.TracebackType, types.FrameType, types.CodeType) + six.class_types):
364367
try:
365368
lines, first = inspect.getsourcelines(val)

0 commit comments

Comments
 (0)