[issue19152] Add ExtensionFileLoader.get_filename().
This commit is contained in:
parent
e8bbfebee0
commit
5179445520
|
@ -836,7 +836,7 @@ find and load modules.
|
|||
|
||||
.. class:: ExtensionFileLoader(fullname, path)
|
||||
|
||||
A concrete implementation of :class:`importlib.abc.InspectLoader` for
|
||||
A concrete implementation of :class:`importlib.abc.ExecutionLoader` for
|
||||
extension modules.
|
||||
|
||||
The *fullname* argument specifies the name of the module the loader is to
|
||||
|
@ -870,6 +870,10 @@ find and load modules.
|
|||
|
||||
Returns ``None`` as extension modules do not have source code.
|
||||
|
||||
.. method:: get_filename(fullname)
|
||||
|
||||
Returns :attr:`path`.
|
||||
|
||||
|
||||
:mod:`importlib.util` -- Utility code for importers
|
||||
---------------------------------------------------
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -361,6 +361,8 @@ Library
|
|||
- Issue #19951: Fix docstring and use of _get_suppported_file_loaders() to
|
||||
reflect 2-tuples.
|
||||
|
||||
- Issue #19152: Add ExtensionFileLoader.get_filename().
|
||||
|
||||
- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get
|
||||
docstrings and ValueError messages. Patch by Zhongyue Luo
|
||||
|
||||
|
|
2718
Python/importlib.h
2718
Python/importlib.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue