mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
Issue #14583: Fix importlib bug when a package's __init__.py would first import one of its modules then raise an error.
This commit is contained in:
parent
943cab2fec
commit
6efa50a384
6 changed files with 374 additions and 308 deletions
|
@ -1082,7 +1082,7 @@ def __import__(name, globals={}, locals={}, fromlist=[], level=0):
|
|||
# Return up to the first dot in 'name'. This is complicated by the fact
|
||||
# that 'name' may be relative.
|
||||
if level == 0:
|
||||
return sys.modules[name.partition('.')[0]]
|
||||
return _gcd_import(name.partition('.')[0])
|
||||
elif not name:
|
||||
return module
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue