File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,11 @@ def __init__(
138138 if not actor_ref .is_alive ():
139139 msg = f"{ actor_ref } not found"
140140 raise ActorDeadError (msg )
141+ if (actor := actor_ref ._actor_weakref ()) is None : # noqa: SLF001
142+ msg = f"{ actor_ref } 's actor weakref has been deallocated"
143+ raise ActorDeadError (msg )
141144 self .actor_ref = actor_ref
142- self ._actor = actor_ref . _actor # noqa: SLF001
145+ self ._actor = actor
143146 self ._attr_path = attr_path or ()
144147 self ._known_attrs = introspect_attrs (root = self ._actor , proxy = self )
145148 self ._actor_proxies = {}
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import weakref
34from typing import (
45 TYPE_CHECKING ,
56 Any ,
@@ -51,7 +52,7 @@ def __init__(
5152 self ,
5253 actor : A ,
5354 ) -> None :
54- self ._actor = actor
55+ self ._actor_weakref = weakref . ref ( actor )
5556 self .actor_class = actor .__class__
5657 self .actor_urn = actor .actor_urn
5758 self .actor_inbox = actor .actor_inbox
You can’t perform that action at this time.
0 commit comments