Commit 78401f71 authored by orlnub123's avatar orlnub123 Committed by Victor Stinner

importlib doc: Fix approximated import_module() code (GH-9945)

The spec gets stored on modules with the __spec__ attribute, not spec.
parent e80e77a4
......@@ -1731,7 +1731,7 @@ Python 3.6 and newer for other parts of the code).
if '.' in absolute_name:
parent_name, _, child_name = absolute_name.rpartition('.')
parent_module = import_module(parent_name)
path = parent_module.spec.submodule_search_locations
path = parent_module.__spec__.submodule_search_locations
for finder in sys.meta_path:
spec = finder.find_spec(absolute_name, path)
if spec is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment