- fix sage_getfile() by checking all possible EXTENSION_SUFFIXES --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -1400,8 +1403,9 @@ def sage_getfile(obj): sourcefile = inspect.getabsfile(obj) except TypeError: # this happens for Python builtins return '' - if sourcefile.endswith(loadable_module_extension()): - return sourcefile[:-len(loadable_module_extension())]+os.path.extsep+'pyx' + for suffix in import_machinery.EXTENSION_SUFFIXES: + if sourcefile.endswith(suffix): + return sourcefile[:-len(suffix)]+os.path.extsep+'pyx' return sourcefile