From e017cb67f92d68200c8a838ee6f9ec0bc68f646e Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Thu, 1 Nov 2018 15:10:51 -0400 Subject: Tornado 5.0 made an incompatible API change in iostream.BaseIOStream. Found when upgrading Ubuntu to 18.10. --- cryptech_muxd | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cryptech_muxd b/cryptech_muxd index 1aecb1e..ff40048 100755 --- a/cryptech_muxd +++ b/cryptech_muxd @@ -128,8 +128,16 @@ class SerialIOStream(tornado.iostream.BaseIOStream): def write_to_fd(self, data): return self.serial.write(data) - def read_from_fd(self): - return self.serial.read(self.read_chunk_size) or None + if tornado.version > "5": + # .. versionchanged:: 5.0 + # Interface redesigned to take a buffer and return a number + # of bytes instead of a freshly-allocated object. + def read_from_fd(self, buf): + buf[:] = self.serial.read(len(buf)) + return len(buf) or None + else: + def read_from_fd(self): + return self.serial.read(self.read_chunk_size) or None class PFUnixServer(tornado.tcpserver.TCPServer): -- cgit v1.2.3