util/jsoncomm: simplify condition

This reduces `if fds && len(fds) > 0:` to `if fds:`. In python, empty
collections are considered false, so the additional check is not needed.
This commit is contained in:
David Rheinsberg 2020-05-28 11:07:37 +02:00
parent 2a9cdde5ec
commit 13c0dec8ee

View file

@ -299,7 +299,7 @@ class Socket(contextlib.AbstractContextManager):
serialized = json.dumps(payload).encode()
cmsg = []
if fds and len(fds) > 0:
if fds:
cmsg.append((socket.SOL_SOCKET, socket.SCM_RIGHTS, array.array("i", fds)))
n = self._socket.sendmsg([serialized], cmsg, 0, destination)