Skip to content

Commit

Permalink
fix: Don't crash on unhandle __all__ assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Apr 19, 2022
1 parent 8f71a07 commit cbc103c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/griffe/agents/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
from griffe.collections import LinesCollection
from griffe.exceptions import LastNodeError, RootNodeError
from griffe.expressions import Expression, Name
from griffe.logger import get_logger

logger = get_logger(__name__)

# TODO: remove once Python 3.7 support is dropped
if sys.version_info < (3, 8):
Expand Down Expand Up @@ -589,7 +592,11 @@ def parse__all__(node: NodeAssign | NodeAugAssign, parent: Module) -> list[str |
Returns:
A set of names.
"""
return _parse__all__(node.value, parent)
try:
return _parse__all__(node.value, parent)
except KeyError as error:
logger.debug(f"Cannot parse __all__ assignment: {get_value(node.value)} ({error})")
return []


# ==========================================================
Expand Down

0 comments on commit cbc103c

Please sign in to comment.