mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
1eb6c0074d
commit
b9c3da5c89
4 changed files with 19 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue