]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
importlib doc: Fix approximated import_module() code (GH-9945)
authororlnub123 <orlnub123@gmail.com>
Wed, 24 Oct 2018 23:32:26 +0000 (02:32 +0300)
committerVictor Stinner <vstinner@redhat.com>
Wed, 24 Oct 2018 23:32:26 +0000 (01:32 +0200)
The spec gets stored on modules with the __spec__ attribute, not spec.

Doc/library/importlib.rst

index 6f4da11989551ea500025ae6464d8f90fec0cf6f..09d5989c2f8b8407cf90b1abc3c0501025f29820 100644 (file)
@@ -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: