From 41983edc439cb22d912701770d22b4b4756d6fc9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 11 Jul 2022 09:42:26 -0400 Subject: [PATCH] Use `str` | `bytes` union for typing msg dump --- tractor/_ipc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tractor/_ipc.py b/tractor/_ipc.py index 6679366..0ed22bb 100644 --- a/tractor/_ipc.py +++ b/tractor/_ipc.py @@ -186,14 +186,14 @@ class MsgpackTCPStream(MsgTransport): # do with a channel drop - hope that receiving from the # channel will raise an expected error and bubble up. try: - data = msg_bytes.decode() + msg_str: str | bytes = msg_bytes.decode() except UnicodeDecodeError: - data = msg_bytes + msg_str = msg_bytes log.error( '`msgspec` failed to decode!?\n' 'dumping bytes:\n' - f'{data}' + f'{msg_str!r}' ) decodes_failed += 1 else: