diff options
author | Sanyam Khurana <CuriousLearner@users.noreply.github.com> | 2017-06-13 22:41:14 +0530 |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2017-06-13 13:11:14 -0400 |
commit | b9c3da5c89c66dcccf382e8f196746da2a06d4cc (patch) | |
tree | cc99f575ae032c7e98b7cc5d1cc707e4b52dc4a2 /Lib/pkgutil.py | |
parent | 1eb6c0074d17f4fd425cacfdda893d65f5f77f0a (diff) | |
download | cpython-git-b9c3da5c89c66dcccf382e8f196746da2a06d4cc.tar.gz |
bpo-24744: Raises error in pkgutil.walk_packages if path is str (#1926)
bpo-24744: Raise error in pkgutil.walk_packages if path is str
Previously an empty result list was accidentallly returned, since the
code iterated over the string as if it were the expected list of paths,
and of course found nothing.
Diffstat (limited to 'Lib/pkgutil.py')
-rw-r--r-- | Lib/pkgutil.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py index e37ad45196..9180eaed84 100644 --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -119,6 +119,9 @@ def iter_modules(path=None, prefix=''): """ 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) |