[Python-checkins] cpython: Closes issue #14982: Document that pkgutil's walk_packages() and

brett.cannon python-checkins at python.org
Sat Jun 16 01:21:13 CEST 2012


http://hg.python.org/cpython/rev/b92fa1c5a96b
changeset:   77455:b92fa1c5a96b
user:        Brett Cannon <brett at python.org>
date:        Fri Jun 15 19:21:07 2012 -0400
summary:
  Closes issue #14982: Document that pkgutil's walk_packages() and
iter_modules() requires iter_modules() be defined on an importer. The
importers in importlib do not define this non-standard method.

files:
  Doc/library/pkgutil.rst |  8 ++++++++
  Misc/NEWS               |  4 ++++
  2 files changed, 12 insertions(+), 0 deletions(-)


diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst
--- a/Doc/library/pkgutil.rst
+++ b/Doc/library/pkgutil.rst
@@ -138,6 +138,10 @@
 
    *prefix* is a string to output on the front of every module name on output.
 
+   .. note::
+      Only works for importers which define a ``iter_modules()`` method, which
+      is non-standard but implemented by classes defined in this module.
+
 
 .. function:: walk_packages(path=None, prefix='', onerror=None)
 
@@ -166,6 +170,10 @@
       # list all submodules of ctypes
       walk_packages(ctypes.__path__, ctypes.__name__ + '.')
 
+   .. note::
+      Only works for importers which define a ``iter_modules()`` method, which
+      is non-standard but implemented by classes defined in this module.
+
 
 .. function:: get_data(package, resource)
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,10 @@
 Library
 -------
 
+- Issue #14982: Document that pkgutil's iteration functions require the
+  non-standard iter_modules() method to be defined by an importer (something
+  the importlib importers do not define).
+
 - Issue #15036: Allow removing or changing multiple items in
   single-file mailboxes (mbox, MMDF, Babyl) flushing the mailbox
   between the changes.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list