void-packages/srcpkgs/sagemath/patches/05-fix_sage_getfile.patch
2022-02-03 14:31:06 +01:00

16 lines
638 B
Diff

- 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