]> granicus.if.org Git - python/commitdiff
Closes issue #14982: Document that pkgutil's walk_packages() and
authorBrett Cannon <brett@python.org>
Fri, 15 Jun 2012 23:21:07 +0000 (19:21 -0400)
committerBrett Cannon <brett@python.org>
Fri, 15 Jun 2012 23:21:07 +0000 (19:21 -0400)
iter_modules() requires iter_modules() be defined on an importer. The
importers in importlib do not define this non-standard method.

Doc/library/pkgutil.rst
Misc/NEWS

index 3118ff204780c1b2dc707fd93aabc0ac557967f5..0aee4e7637f27593a36601e144f66713edcd8587 100644 (file)
@@ -138,6 +138,10 @@ support.
 
    *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 @@ support.
       # 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)
 
index 6acf02b1a7756aed8efa83913f580c8d15a3bd51..d45c5b54982e99a97aeca6b7cc22cbb307828b7b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,10 @@ Core and Builtins
 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.