summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authororlnub123 <orlnub123@gmail.com>2018-10-24 23:32:26 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-10-24 23:32:26 (GMT)
commit78401f7156034f713170b8e87b51d23ebdc3bdfa (patch)
tree55be14593c0cdbfa5fa0ed78f0ff98a4051aa000
parente80e77a484983ffb527ef22d336ff9500589dce3 (diff)
downloadcpython-78401f7156034f713170b8e87b51d23ebdc3bdfa.zip
cpython-78401f7156034f713170b8e87b51d23ebdc3bdfa.tar.gz
cpython-78401f7156034f713170b8e87b51d23ebdc3bdfa.tar.bz2
importlib doc: Fix approximated import_module() code (GH-9945)
The spec gets stored on modules with the __spec__ attribute, not spec.
-rw-r--r--Doc/library/importlib.rst2
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 6f4da11..09d5989 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -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: