mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
[3.6] bpo-31642: Restore blocking "from" import by setting None in sys.modules. (GH-3834). (#3923)
(cherry picked from commit f07e2b64df
)
This commit is contained in:
parent
d13a4e5067
commit
6f059ab80a
4 changed files with 259 additions and 239 deletions
|
@ -1019,7 +1019,8 @@ def _handle_fromlist(module, fromlist, import_):
|
|||
# Backwards-compatibility dictates we ignore failed
|
||||
# imports triggered by fromlist for modules that don't
|
||||
# exist.
|
||||
if exc.name == from_name:
|
||||
if (exc.name == from_name and
|
||||
sys.modules.get(from_name, _NEEDS_LOADING) is not None):
|
||||
continue
|
||||
raise
|
||||
return module
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue