]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
importlib doc: Fix approximated import_module() code (GH-9945)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 24 Oct 2018 23:38:04 +0000 (16:38 -0700)
committerGitHub <noreply@github.com>
Wed, 24 Oct 2018 23:38:04 +0000 (16:38 -0700)
The spec gets stored on modules with the __spec__ attribute, not spec.
(cherry picked from commit 78401f7156034f713170b8e87b51d23ebdc3bdfa)

Co-authored-by: orlnub123 <orlnub123@gmail.com>
Doc/library/importlib.rst

index 356d1608bf4eed4c685cbe4704195a76daa6afc4..760489ae5560e43acbbccf4448b4418918fb0d95 100644 (file)
@@ -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: