]> granicus.if.org Git - python/commitdiff
Issue #16489: Make it clearer that importlib.find_loader() requires
authorBrett Cannon <brett@python.org>
Sat, 17 Nov 2012 14:30:55 +0000 (09:30 -0500)
committerBrett Cannon <brett@python.org>
Sat, 17 Nov 2012 14:30:55 +0000 (09:30 -0500)
the user to import any parent packages.

Doc/library/importlib.rst
Lib/importlib/__init__.py
Misc/NEWS

index 681f1d99cbfd1cd1888ffd6eb5313879c780143d..083656ebf252ce13503b876181bd355492d345a7 100644 (file)
@@ -94,11 +94,10 @@ Functions
    :exc:`ValueError` is raised). Otherwise a search using :attr:`sys.meta_path`
    is done. ``None`` is returned if no loader is found.
 
-   A dotted name does not have its parent's implicitly imported. If that is
-   desired (although not nessarily required to find the loader, it will most
-   likely be needed if the loader actually is used to load the module), then
-   you will have to import the packages containing the module prior to calling
-   this function.
+   A dotted name does not have its parent's implicitly imported as that requires
+   loading them and that may not be desired. To properly import a submodule you
+   will need to import all parent packages of the submodule and use the correct
+   argument to *path*.
 
 .. function:: invalidate_caches()
 
index 6f40dacf13e7efc475c986181c6ce1226795b487..22c90f24a7e46cecbbc87027a319576d7c32c006 100644 (file)
@@ -55,7 +55,9 @@ def find_loader(name, path=None):
     value of 'path' given to the finders. None is returned if no loader could
     be found.
 
-    Dotted names do not have their parent packages implicitly imported.
+    Dotted names do not have their parent packages implicitly imported. You will
+    most likely need to explicitly import all parent packages in the proper
+    order for a submodule to get the correct loader.
 
     """
     try:
index 47bf94ce51688fb1781a061dccb435bdeb10ec65..217eecd7e187119b24b50e8516ebf487540927c2 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -271,6 +271,9 @@ Tools/Demos
 Documentation
 -------------
 
+- Issue #16489: Make it clearer that importlib.find_loader() requires any and
+  all packages to be separately imported.
+
 - Issue #16400: Update the description of which versions of a given package
   PyPI displays.