[Python-checkins] cpython: Close #15519: Properly expose WindowsRegistryFinder in importlib and bring the
nick.coghlan
python-checkins at python.org
Thu Aug 2 13:45:37 CEST 2012
http://hg.python.org/cpython/rev/a1ac1e13c5a0
changeset: 78380:a1ac1e13c5a0
user: Nick Coghlan <ncoghlan at gmail.com>
date: Thu Aug 02 21:45:24 2012 +1000
summary:
Close #15519: Properly expose WindowsRegistryFinder in importlib and bring the name into line with normal import terminology. Original patch by Eric Snow
files:
Doc/library/importlib.rst | 11 +
Lib/importlib/_bootstrap.py | 8 +-
Lib/importlib/abc.py | 2 +-
Lib/importlib/machinery.py | 1 +
Lib/test/test_importlib/test_abc.py | 2 +-
Misc/NEWS | 3 +
Python/importlib.h | 5018 +++++++-------
7 files changed, 2529 insertions(+), 2516 deletions(-)
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -603,6 +603,17 @@
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
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -720,9 +720,9 @@
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 @@
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 @@
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)
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -59,7 +59,7 @@
raise NotImplementedError
_register(MetaPathFinder, machinery.BuiltinImporter, machinery.FrozenImporter,
- machinery.PathFinder)
+ machinery.PathFinder, machinery.WindowsRegistryFinder)
class PathEntryFinder(Finder):
diff --git a/Lib/importlib/machinery.py b/Lib/importlib/machinery.py
--- a/Lib/importlib/machinery.py
+++ b/Lib/importlib/machinery.py
@@ -6,6 +6,7 @@
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
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -34,7 +34,7 @@
superclasses = [abc.Finder]
subclasses = [machinery.BuiltinImporter, machinery.FrozenImporter,
- machinery.PathFinder]
+ machinery.PathFinder, machinery.WindowsRegistryFinder]
class PathEntryFinder(InheritanceTests, unittest.TestCase):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -72,6 +72,9 @@
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.
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list