From 1dee974aea5c9837cf69070065a020c91b60e134 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 31 Oct 2021 13:41:50 -0400 Subject: [PATCH] serialhdl: Use regular str() type for stats on Python2 Avoid using unicode() types on Python2 as it can lead to subtle errors. Signed-off-by: Kevin O'Connor --- klippy/serialhdl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py index b4102c6a..b916ab20 100644 --- a/klippy/serialhdl.py +++ b/klippy/serialhdl.py @@ -218,9 +218,9 @@ class SerialReader: def stats(self, eventtime): if self.serialqueue is None: return "" - self.ffi_lib.serialqueue_get_stats( - self.serialqueue, self.stats_buf, len(self.stats_buf)) - return self.ffi_main.string(self.stats_buf).decode() + self.ffi_lib.serialqueue_get_stats(self.serialqueue, + self.stats_buf, len(self.stats_buf)) + return str(self.ffi_main.string(self.stats_buf).decode()) def get_reactor(self): return self.reactor def get_msgparser(self):