[Python-checkins] cpython (merge 3.3 -> default): Merge fix for #16489 from 3.3

brett.cannon python-checkins at python.org
Sat Nov 17 15:33:50 CET 2012


http://hg.python.org/cpython/rev/ba1d7447bd1b
changeset: 80468:ba1d7447bd1b
parent: 80466:18c47f9d6303
parent: 80467:358be7742377
user: Brett Cannon <brett at python.org>
date: Sat Nov 17 09:33:14 2012 -0500
summary:
 Merge fix for #16489 from 3.3
files:
 Doc/library/importlib.rst | 9 ++++-----
 Lib/importlib/__init__.py | 4 +++-
 Misc/NEWS | 3 +++
 3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -94,11 +94,10 @@
 :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()
 
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py
--- a/Lib/importlib/__init__.py
+++ b/Lib/importlib/__init__.py
@@ -55,7 +55,9 @@
 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:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -376,6 +376,9 @@
 Documentation
 -------------
 
+- Issue #16489: Make it clearer that importlib.find_loader() needs parent
+ packages to be explicitly imported.
+
 - Issue #16400: Update the description of which versions of a given package
 PyPI displays.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /