Close #15519: Properly expose WindowsRegistryFinder in importlib and bring the name into line with normal import terminology. Original patch by Eric Snow

This commit is contained in:
Nick Coghlan
2012-08-02 21:45:24 +10:00
parent 8a9080feff
commit ff79486bb5
7 changed files with 2537 additions and 2524 deletions
+11
View File
@@ -603,6 +603,17 @@ find and load modules.
instantiation.
.. class:: WindowsRegistryFinder
:term:`Finder` for modules declared in the Windows registry. This class
implements the :class:`importlib.abc.MetaPathFinder` ABC.
Only class methods are defined by this class to alleviate the need for
instantiation.
.. versionadded:: 3.3
.. class:: PathFinder
:term:`Finder` for :data:`sys.path`. This class implements the
+4 -4
View File
@@ -720,9 +720,9 @@ class FrozenImporter:
return _imp.is_frozen_package(fullname)
class WindowsRegistryImporter:
class WindowsRegistryFinder:
"""Meta path import for modules declared in the Windows registry.
"""Meta path finder for modules declared in the Windows registry.
"""
REGISTRY_KEY = (
@@ -1683,7 +1683,7 @@ def _setup(sys_module, _imp_module):
if builtin_os == 'nt':
SOURCE_SUFFIXES.append('.pyw')
if '_d.pyd' in _imp.extension_suffixes():
WindowsRegistryImporter.DEBUG_BUILD = True
WindowsRegistryFinder.DEBUG_BUILD = True
def _install(sys_module, _imp_module):
@@ -1694,5 +1694,5 @@ def _install(sys_module, _imp_module):
sys.meta_path.append(BuiltinImporter)
sys.meta_path.append(FrozenImporter)
if _os.__name__ == 'nt':
sys.meta_path.append(WindowsRegistryImporter)
sys.meta_path.append(WindowsRegistryFinder)
sys.meta_path.append(PathFinder)
+1 -1
View File
@@ -59,7 +59,7 @@ class MetaPathFinder(Finder):
raise NotImplementedError
_register(MetaPathFinder, machinery.BuiltinImporter, machinery.FrozenImporter,
machinery.PathFinder)
machinery.PathFinder, machinery.WindowsRegistryFinder)
class PathEntryFinder(Finder):
+1
View File
@@ -6,6 +6,7 @@ from ._bootstrap import (SOURCE_SUFFIXES, DEBUG_BYTECODE_SUFFIXES,
OPTIMIZED_BYTECODE_SUFFIXES, BYTECODE_SUFFIXES)
from ._bootstrap import BuiltinImporter
from ._bootstrap import FrozenImporter
from ._bootstrap import WindowsRegistryFinder
from ._bootstrap import PathFinder
from ._bootstrap import FileFinder
from ._bootstrap import SourceFileLoader
+1 -1
View File
@@ -34,7 +34,7 @@ class MetaPathFinder(InheritanceTests, unittest.TestCase):
superclasses = [abc.Finder]
subclasses = [machinery.BuiltinImporter, machinery.FrozenImporter,
machinery.PathFinder]
machinery.PathFinder, machinery.WindowsRegistryFinder]
class PathEntryFinder(InheritanceTests, unittest.TestCase):
+3
View File
@@ -72,6 +72,9 @@ Core and Builtins
Library
-------
- Issue #15519: Properly expose WindowsRegistryFinder in importlib (and use
the correct term for it). Original patch by Eric Snow.
- Issue #15502: Bring the importlib ABCs into line with the current state
of the import protocols given PEP 420. Original patch by Eric Snow.
+2516 -2518
View File
File diff suppressed because it is too large Load Diff