Skip to content

Commit 3be757f

Browse files
committed
Raise ValueError on invalid parent
Signed-off-by: Filipe Laíns <lains@riseup.net>
1 parent dc6faa2 commit 3be757f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,8 @@ def find_spec(cls, fullname, path=None, target=None):
13271327
def discover(cls, parent=None):
13281328
if parent is None:
13291329
path = sys.path
1330+
elif parent.submodule_search_locations is None:
1331+
raise ValueError(f'{parent} is not a package module')
13301332
else:
13311333
path = parent.submodule_search_locations
13321334

0 commit comments

Comments
 (0)