mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Allow importlib.__import__ to accept any iterable for fromlist. Discovered when
running importlib against test___all__.
This commit is contained in:
parent
12c3fc9343
commit
9e0e1a63c8
3 changed files with 12 additions and 2 deletions
|
@ -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)):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue