Skip to content

Commit

Permalink
fix: Don't reassign members defined in except clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Nov 30, 2021
1 parent a3f4438 commit d918b4e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/griffe/agents/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@ def handle_attribute( # noqa: WPS231
if "." in name:
continue

if name in parent.members:
# assigning multiple times: check for try/excepts
# TODO: might be better to inspect
if isinstance(node.parent, ast.ExceptHandler): # type: ignore[union-attr]
continue # prefer "no-exception" case

attribute = Attribute(
name=name,
value=value,
Expand Down

0 comments on commit d918b4e

Please sign in to comment.