From 562419c9074a2f0a3fa5429c840744b7546eac57 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 5 Sep 2021 16:44:35 -0400 Subject: [PATCH] Convert actor UIDs to hashable tuples `msgspec` sends python lists over the wire (https://github.com/jcrist/msgspec/issues/30) which is fine and dandy but we use them as lookup keys so we need to be sure we tuple-cast first. --- tractor/_actor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tractor/_actor.py b/tractor/_actor.py index ee7a1d8..cddfb1f 100644 --- a/tractor/_actor.py +++ b/tractor/_actor.py @@ -318,7 +318,7 @@ class Actor: # @dataclass once we get py3.7 self.loglevel = loglevel - self._arb_addr = arbiter_addr or (None, None) + self._arb_addr = arbiter_addr # marked by the process spawning backend at startup # will be None for the parent most process started manually @@ -797,8 +797,8 @@ class Actor: # XXX: msgspec doesn't support serializing tuples # so just cash manually here since it's what our # internals expect. - address: Tuple[str, int] = value - self._arb_addr = value + address: Tuple[str, int] = tuple(value) + self._arb_addr = address else: setattr(self, attr, value) @@ -1181,7 +1181,7 @@ class Actor: parlance. """ await chan.send(self.uid) - uid: Tuple[str, str] = await chan.recv() + uid: Tuple[str, str] = tuple(await chan.recv()) if not isinstance(uid, tuple): raise ValueError(f"{uid} is not a valid uid?!") @@ -1254,7 +1254,7 @@ class Arbiter(Actor): sockaddr: Tuple[str, str] ) -> None: - name, uuid = tuple(uid) + name, uuid = uid = tuple(uid) self._registry[uid] = tuple(sockaddr) # pop and signal all waiter events