void-packages/srcpkgs/sagemath/patches/05-fix_sage_getfile.patch

17 lines
638 B
Diff
Raw Normal View History

2022-01-31 15:50:38 +00:00
- 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