Skip to content

Commit

Permalink
fix: Fix crash when trying to get docstring after assignment (found t…
Browse files Browse the repository at this point in the history
…hanks to pysource-codegen)
  • Loading branch information
pawamoy committed Oct 6, 2023
1 parent 7e53288 commit fb0a0c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/griffe/agents/nodes/_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_docstring(
# TODO: possible optimization using a type map
if isinstance(node, ast.Expr):
doc = node.value
elif node.body and isinstance(node.body[0], ast.Expr) and not strict: # type: ignore[attr-defined]
elif not strict and node.body and isinstance(node.body, list) and isinstance(node.body[0], ast.Expr): # type: ignore[attr-defined]
doc = node.body[0].value # type: ignore[attr-defined]
else:
return None, None, None
Expand Down

0 comments on commit fb0a0c1

Please # to comment.