Skip to content

Commit

Permalink
fix: Don't crash and show hint when wildcard expansion fails
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Dec 4, 2022
1 parent 8ef14ab commit 336faf6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/griffe/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ def expand_exports(self, module: Module, seen: set | None = None) -> None: # no
for export in module.exports:
if isinstance(export, Name):
module_path = export.full.rsplit(".", 1)[0] # remove trailing .__all__
next_module = self.modules_collection[module_path]
try:
next_module = self.modules_collection[module_path]
except KeyError:
logger.debug(f"Cannot expand '{export.full}', try pre-loading corresponding package")
continue
if next_module.path not in seen:
self.expand_exports(next_module, seen)
try:
Expand Down

0 comments on commit 336faf6

Please sign in to comment.