Allow importlib.__import__ to accept any iterable for fromlist. Discovered when

running importlib against test___all__.
This commit is contained in:
Brett Cannon 2009-08-30 18:28:46 +00:00
parent 12c3fc9343
commit 9e0e1a63c8
3 changed files with 12 additions and 2 deletions

View file

@ -943,6 +943,7 @@ def __import__(name, globals={}, locals={}, fromlist=[], level=0):
# If a package was imported, try to import stuff from fromlist.
if hasattr(module, '__path__'):
if '*' in fromlist and hasattr(module, '__all__'):
fromlist = list(fromlist)
fromlist.remove('*')
fromlist.extend(module.__all__)
for x in (y for y in fromlist if not hasattr(module,y)):