File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 4
4
import inspect
5
5
import subprocess
6
6
from pathlib import Path
7
+ from functools import cached_property
7
8
from sphinx .application import Sphinx
8
9
from sphinx .errors import ExtensionError
9
10
from typing import Dict , Any , Optional , Callable
@@ -191,6 +192,11 @@ def linkcode_resolve(domain, info):
191
192
except AttributeError :
192
193
return None
193
194
195
+ if isinstance (obj , property ):
196
+ obj = obj .fget
197
+ elif isinstance (obj , cached_property ):
198
+ obj = obj .func
199
+
194
200
try :
195
201
modpath = inspect .getsourcefile (inspect .unwrap (obj ))
196
202
filepath = Path (modpath ).relative_to (repo_dir )
@@ -201,10 +207,10 @@ def linkcode_resolve(domain, info):
201
207
202
208
try :
203
209
source , lineno = inspect .getsourcelines (obj )
204
- except OSError :
210
+ except Exception :
205
211
return None
206
- else :
207
- linestart , linestop = lineno , lineno + len (source ) - 1
212
+
213
+ linestart , linestop = lineno , lineno + len (source ) - 1
208
214
209
215
# Example: https://github.com/TDKorn/my-magento/blob/docs/magento/models/model.py#L28-L59
210
216
final_link = linkcode_url .format (
You can’t perform that action at this time.
0 commit comments