summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2013-10-03 18:08:55 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2013-10-03 18:08:55 (GMT)
commit51794455208e182f5f2e3ca1174b1361c46f8e04 (patch)
tree608221b74457018c1030908c7bf83a5afaa52b37 /Lib
parente8bbfebee01634ad0d3c903b54343d050f452b49 (diff)
downloadcpython-51794455208e182f5f2e3ca1174b1361c46f8e04.zip
cpython-51794455208e182f5f2e3ca1174b1361c46f8e04.tar.gz
cpython-51794455208e182f5f2e3ca1174b1361c46f8e04.tar.bz2
[issue19152] Add ExtensionFileLoader.get_filename().
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_bootstrap.py5
-rw-r--r--Lib/importlib/abc.py2
2 files changed, 7 insertions, 0 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 0afe6a5..a95d8b6 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1171,6 +1171,11 @@ class ExtensionFileLoader:
"""Return None as extension modules have no source code."""
return None
+ @_check_name
+ def get_filename(self, fullname):
+ """Return the path to the source file as found by the finder."""
+ return self.path
+
class _NamespacePath:
"""Represents a namespace package's path. It uses the module name
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
index 082796c..dcbe010 100644
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -237,6 +237,8 @@ class ExecutionLoader(InspectLoader):
super().init_module_attrs(module)
_bootstrap._init_file_attrs(self, module)
+_register(machinery.ExtensionFileLoader)
+
class FileLoader(_bootstrap.FileLoader, ResourceLoader, ExecutionLoader):