Update msgpack calls for newer msgpack

This commit is contained in:
twangboy 2019-05-07 16:34:21 -06:00
parent 77355e25fe
commit 0abd1ec0ce
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

View file

@ -254,11 +254,15 @@ class IPCClient(object):
self.socket_path = socket_path
self._closing = False
self.stream = None
if six.PY2:
encoding = None
# msgpack deprecated `encoding` starting with version 0.5.2
if msgpack.version >= (0, 5, 2):
msgpack_kwargs = {'raw': False}
else:
encoding = 'utf-8'
self.unpacker = msgpack.Unpacker(encoding=encoding)
if six.PY2:
msgpack_kwargs = {'encoding': None}
else:
msgpack_kwargs = {'encoding': 'utf-8'}
self.unpacker = msgpack.Unpacker(**msgpack_kwargs)
def connected(self):
return self.stream is not None and not self.stream.closed()