Issue #14605: Expose importlib.abc.FileLoader and
importlib.machinery.(FileFinder, SourceFileLoader,
_SourcelessFileLoader, ExtensionFileLoader).
This exposes all of importlib's mechanisms that will become public on
the sys module.
diff --git a/Lib/imp.py b/Lib/imp.py
index 3ab69e5..f35247c 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -71,7 +71,7 @@
def get_data(self, path):
"""Gross hack to contort loader to deal w/ load_*()'s bad API."""
- if self.file and path == self._path:
+ if self.file and path == self.path:
with self.file:
# Technically should be returning bytes, but
# SourceLoader.get_code() just passed what is returned to
@@ -83,7 +83,7 @@
return super().get_data(path)
-class _LoadSourceCompatibility(_HackedGetData, _bootstrap._SourceFileLoader):
+class _LoadSourceCompatibility(_HackedGetData, _bootstrap.SourceFileLoader):
"""Compatibility support for implementing load_source()."""
@@ -115,7 +115,7 @@
break
else:
raise ValueError('{!r} is not a package'.format(path))
- return _bootstrap._SourceFileLoader(name, path).load_module(name)
+ return _bootstrap.SourceFileLoader(name, path).load_module(name)
# XXX deprecate