Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/sage/misc/sageinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,10 @@ def _extract_embedded_position(docstring):
from sage.misc.temporary_file import spyx_tmp
if raw_filename.startswith('sage/'):
import sage
try_filenames = [os.path.join(directory, raw_filename[5:])
from sage.env import SAGE_SRC
try_filenames = [os.path.join(directory, raw_filename.removeprefix('sage/'))
for directory in sage.__path__]
try_filenames.append(os.path.join(SAGE_SRC, raw_filename)) # meson editable install
else:
try_filenames = []
try_filenames.append(
Expand Down Expand Up @@ -1286,6 +1288,15 @@ def sage_getfile(obj):
sage: sage_getfile(P) # needs sage.libs.singular
'...sage/rings/polynomial/multi_polynomial_libsingular...'

Another bug with editable meson install::

sage: P.<x,y> = QQ[]
sage: I = P * [x,y]
sage: path = sage_getfile(I.groebner_basis); path
'.../sage/rings/qqbar_decorators.py'
sage: path == sage_getfile(sage.rings.qqbar_decorators)
True

A problem fixed in :issue:`16309`::

sage: cython( # needs sage.misc.cython
Expand Down Expand Up @@ -1325,7 +1336,7 @@ def sage_getfile(obj):
return ''
for suffix in import_machinery.EXTENSION_SUFFIXES:
if sourcefile.endswith(suffix):
return sourcefile[:-len(suffix)]+os.path.extsep+'pyx'
return sourcefile.removesuffix(suffix)+os.path.extsep+'pyx'
return sourcefile


Expand Down
Loading