From: John Snow Date: Thu, 14 May 2020 05:53:51 +0000 (-0400) Subject: python/qemu/qmp: assert sockfile is not None X-Git-Tag: qemu-xen-4.15.0~166^2~9 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=de210ec53c842fa67aa10110a7a351d64f91c487;p=qemu-xen.git python/qemu/qmp: assert sockfile is not None In truth, if you don't do this, you'll just get a TypeError exception. Now, you'll get an AssertionError. Is this tangibly better? No. Does mypy complain less? Yes. Signed-off-by: John Snow Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200514055403.18902-21-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index a634c4e26c..e64b6b5faa 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -94,6 +94,7 @@ class QEMUMonitorProtocol: raise QMPCapabilitiesError def __json_read(self, only_event=False): + assert self.__sockfile is not None while True: data = self.__sockfile.readline() if not data: