Skip to content

Commit

Permalink
fix: Make sure passage through aliases is reset
Browse files Browse the repository at this point in the history
Issue #123: #123
  • Loading branch information
pawamoy committed Dec 23, 2022
1 parent bb62b2f commit 79733f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/griffe/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,12 @@ def resolve_target(self) -> None: # noqa: WPS231,WPS238
if self._passed_through:
raise CyclicAliasError([self.target_path])
self._passed_through = True
try: # noqa: WPS501
self._resolve_target()
finally:
self._passed_through = False

def _resolve_target(self) -> None:
try:
resolved = self.modules_collection[self.target_path]
except KeyError as error:
Expand All @@ -1112,8 +1118,6 @@ def resolve_target(self) -> None: # noqa: WPS231,WPS238
resolved.resolve_target()
except CyclicAliasError as error: # noqa: WPS440
raise CyclicAliasError([self.target_path] + error.chain)
finally:
self._passed_through = False
self._target = resolved
if self.parent is not None:
self._target.aliases[self.path] = self # type: ignore[union-attr] # we just set the target
Expand Down

0 comments on commit 79733f4

Please sign in to comment.