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

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)

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):

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