mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-31642: Restore blocking "from" import by setting None in sys.modules. (#3834)
This commit is contained in:
parent
73ffd3f203
commit
f07e2b64df
4 changed files with 262 additions and 243 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