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