[Python-checkins] importlib doc: Fix approximated import_module() code (GH-9945)

Miss Islington (bot) webhook-mailer at python.org
Wed Oct 24 19:38:07 EDT 2018


https://github.com/python/cpython/commit/7717bf992c586bd4152a83c98af59a592bc8adc1
commit: 7717bf992c586bd4152a83c98af59a592bc8adc1
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-24T16:38:04-07:00
summary:

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


The spec gets stored on modules with the __spec__ attribute, not spec.
(cherry picked from commit 78401f7156034f713170b8e87b51d23ebdc3bdfa)

Co-authored-by: orlnub123 <orlnub123 at gmail.com>

files:
M Doc/library/importlib.rst

diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 356d1608bf4e..760489ae5560 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -1482,7 +1482,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:



More information about the Python-checkins mailing list