From 8840b289688660998b12973ccef58dc19406c1d9 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Wed, 20 May 2020 17:04:50 +0300 Subject: [PATCH] Handle possible issue on Python 2.x when writing to thread buffer The problem happens when value has type "unicode" that shouldn't be decoded --- platformio/commands/home/rpc/handlers/piocore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/commands/home/rpc/handlers/piocore.py b/platformio/commands/home/rpc/handlers/piocore.py index cea7cb5b..44cb6983 100644 --- a/platformio/commands/home/rpc/handlers/piocore.py +++ b/platformio/commands/home/rpc/handlers/piocore.py @@ -52,7 +52,7 @@ class MultiThreadingStdStream(object): thread_id = thread_get_ident() self._ensure_thread_buffer(thread_id) return self._buffers[thread_id].write( - value.decode() if is_bytes(value) else value + value.decode() if not PY2 and is_bytes(value) else value ) def get_value_and_reset(self):