Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pykka/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ def __init__(
if not actor_ref.is_alive():
msg = f"{actor_ref} not found"
raise ActorDeadError(msg)
if (actor := actor_ref._actor_weakref()) is None: # noqa: SLF001
msg = f"{actor_ref}'s actor weakref has been deallocated"
raise ActorDeadError(msg)
self.actor_ref = actor_ref
self._actor = actor_ref._actor # noqa: SLF001
self._actor = actor
self._attr_path = attr_path or ()
self._known_attrs = introspect_attrs(root=self._actor, proxy=self)
self._actor_proxies = {}
Expand Down
3 changes: 2 additions & 1 deletion src/pykka/_ref.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import weakref
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -51,7 +52,7 @@ def __init__(
self,
actor: A,
) -> None:
self._actor = actor
self._actor_weakref = weakref.ref(actor)
self.actor_class = actor.__class__
self.actor_urn = actor.actor_urn
self.actor_inbox = actor.actor_inbox
Expand Down
Loading