[Python-checkins] r52961 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py
brett.cannon
python-checkins at python.org
Thu Dec 7 23:01:24 CET 2006
Author: brett.cannon
Date: Thu Dec 7 23:01:23 2006
New Revision: 52961
Modified:
sandbox/trunk/import_in_py/importer.py
sandbox/trunk/import_in_py/test_importer.py
Log:
fromlist can be a tuple, so make sure that situation is supported.
Modified: sandbox/trunk/import_in_py/importer.py
==============================================================================
--- sandbox/trunk/import_in_py/importer.py (original)
+++ sandbox/trunk/import_in_py/importer.py Thu Dec 7 23:01:23 2006
@@ -769,7 +769,7 @@
# package, then if a name in fromlist is not found as an
# attribute on module, try a relative import to find it.
# Failure is fine and is the exception is suppressed.
- check_for = fromlist[:]
+ check_for = list(fromlist)
if '*' in check_for and hasattr(module, '__all__'):
check_for.extend(module.__all__)
for item in check_for:
Modified: sandbox/trunk/import_in_py/test_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/test_importer.py (original)
+++ sandbox/trunk/import_in_py/test_importer.py Thu Dec 7 23:01:23 2006
@@ -931,7 +931,8 @@
sys.modules[pkg_name] = pkg_module
succeed = mock_importer.SucceedImporter()
sys.meta_path.append(succeed)
- module = self.importer(pkg_name, fromlist=['*'])
+ # Also tests that fromlist can be a tuple and still work.
+ module = self.importer(pkg_name, fromlist=('*',))
self.failUnless(hasattr(module, module_name))
relative_module = getattr(module, module_name)
self.failUnlessEqual(relative_module.__name__, full_module_name)
More information about the Python-checkins
mailing list