]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
python/qemu/qmp: assert sockfile is not None
authorJohn Snow <jsnow@redhat.com>
Thu, 14 May 2020 05:53:51 +0000 (01:53 -0400)
committerPhilippe Mathieu-Daudé <philmd@redhat.com>
Sun, 31 May 2020 16:25:31 +0000 (18:25 +0200)
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 <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200514055403.18902-21-jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
python/qemu/qmp.py

index a634c4e26c814688959fb7eabc9115aff0f60ed2..e64b6b5faa747d6146e30ac1d2079a052c60be30 100644 (file)
@@ -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: