Changes in the Python API
-------------------------
+* :meth:`pkgutil.walk_packages` now raises ValueError if *path* is a string.
+ Previously an empty list was returned. (Contributed by Sanyam Khurana in
+ :issue:`24744`.)
+
* A format string argument for :meth:`string.Formatter.format`
is now :ref:`positional-only <positional-only_parameter>`.
Passing it as a keyword argument was deprecated in Python 3.5. (Contributed
"""
if path is None:
importers = iter_importers()
+ elif isinstance(path, str):
+ raise ValueError("path must be None or list of paths to look for "
+ "modules in")
else:
importers = map(get_importer, path)
continue
del sys.modules[pkg]
+ def test_walk_packages_raises_on_string_or_bytes_input(self):
+
+ str_input = 'test_dir'
+ with self.assertRaises((TypeError, ValueError)):
+ list(pkgutil.walk_packages(str_input))
+
+ bytes_input = b'test_dir'
+ with self.assertRaises((TypeError, ValueError)):
+ list(pkgutil.walk_packages(bytes_input))
class PkgutilPEP302Tests(unittest.TestCase):
Library
-------
+- bpo-24744: pkgutil.walk_packages function now raises ValueError if *path*
+ is a string. Patch by Sanyam Khurana.
+
- bpo-24484: Avoid race condition in multiprocessing cleanup.
- bpo-30589: Fix multiprocessing.Process.exitcode to return the opposite