File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -283,6 +283,8 @@ ABC hierarchy::
283283
284284 Returns an iterable of possible specs.
285285
286+ Raises :exc: `ValueError ` if *parent * is not a package module.
287+
286288 .. warning ::
287289 This method can potentially yield a very large number of objects, and
288290 it may carry out IO operations when computing these values.
@@ -335,6 +337,8 @@ ABC hierarchy::
335337
336338 Returns an iterable of possible specs.
337339
340+ Raises :exc: `ValueError ` if *parent * is not a package module.
341+
338342 .. warning ::
339343 This method can potentially yield a very large number of objects, and
340344 it may carry out IO operations when computing these values.
Original file line number Diff line number Diff line change @@ -1512,6 +1512,9 @@ def _find_children(self):
15121512 break
15131513
15141514 def discover (self , parent = None ):
1515+ if parent and parent .submodule_search_locations is None :
1516+ raise ValueError (f'{ parent } is not a package module' )
1517+
15151518 module_prefix = f'{ parent .name } .' if parent else ''
15161519 for child_name in self ._find_children ():
15171520 if spec := self .find_spec (module_prefix + child_name ):
You can’t perform that action at this time.
0 commit comments