[Python-checkins] cpython: Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder.
eric.snow
python-checkins at python.org
Fri Jan 3 06:31:31 CET 2014
http://hg.python.org/cpython/rev/7dbb4c6cd30e
changeset: 88269:7dbb4c6cd30e
user: Eric Snow <ericsnowcurrently at gmail.com>
date: Thu Jan 02 22:25:00 2014 -0700
summary:
Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder.
files:
Lib/importlib/_bootstrap.py | 2 +-
Lib/test/test_importlib/test_windows.py | 29 +
Misc/NEWS | 2 +
Python/importlib.h | 3726 +++++-----
4 files changed, 1895 insertions(+), 1864 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1406,7 +1406,7 @@
@classmethod
def find_module(cls, fullname, path=None):
"""Find module named in the registry."""
- spec = self.find_spec(fullname, path)
+ spec = cls.find_spec(fullname, path)
if spec is not None:
return spec.loader
else:
diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py
new file mode 100644
--- /dev/null
+++ b/Lib/test/test_importlib/test_windows.py
@@ -0,0 +1,29 @@
+from . import util
+frozen_machinery, source_machinery = util.import_importlib('importlib.machinery')
+
+import sys
+import unittest
+
+
+ at unittest.skipUnless(sys.platform.startswith('win'), 'requires Windows')
+class WindowsRegistryFinderTests:
+
+ # XXX Need a test that finds the spec via the registry.
+
+ def test_find_spec_missing(self):
+ spec = self.machinery.WindowsRegistryFinder.find_spec('spam')
+ self.assertIs(spec, None)
+
+ def test_find_module_missing(self):
+ loader = self.machinery.WindowsRegistryFinder.find_module('spam')
+ self.assertIs(loader, None)
+
+
+class Frozen_WindowsRegistryFinderTests(WindowsRegistryFinderTests,
+ unittest.TestCase):
+ machinery = frozen_machinery
+
+
+class Source_WindowsRegistryFinderTests(WindowsRegistryFinderTests,
+ unittest.TestCase):
+ machinery = source_machinery
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,6 +36,8 @@
- Issue #19736: Add module-level statvfs constants defined for GNU/glibc
based systems.
+- Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder.
+
- Issue #19729: In str.format(), fix recursive expansion in format spec.
- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2
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