@@ -539,14 +539,14 @@ def linkcode_resolve(domain, info):
539
539
fn = None
540
540
lineno = None
541
541
542
- # Make a poor effort at linking C extension types
543
- if isinstance (obj , type ) and obj .__module__ == 'numpy' :
544
- fn = _get_c_source_file (obj )
542
+ if isinstance (obj , type ):
543
+ # Make a poor effort at linking C extension types
544
+ if obj .__module__ == 'numpy' :
545
+ fn = _get_c_source_file (obj )
545
546
546
- # This can be removed when removing the decorator set_module. Fix issue #28629
547
- if hasattr (obj , '_module_file' ):
548
- fn = obj ._module_file
549
- fn = relpath (fn , start = dirname (numpy .__file__ ))
547
+ # This can be removed when removing the decorator set_module. Fix issue #28629
548
+ if hasattr (obj , '_module_source' ):
549
+ obj .__module__ , obj ._module_source = obj ._module_source , obj .__module__
550
550
551
551
if fn is None :
552
552
try :
@@ -573,6 +573,9 @@ def linkcode_resolve(domain, info):
573
573
else :
574
574
linespec = ""
575
575
576
+ if isinstance (obj , type ) and hasattr (obj , '_module_source' ):
577
+ obj .__module__ , obj ._module_source = obj ._module_source , obj .__module__
578
+
576
579
if 'dev' in numpy .__version__ :
577
580
return f"https://github.com/numpy/numpy/blob/main/numpy/{ fn } { linespec } "
578
581
else :
0 commit comments