diff mbox series

[PULL,16/25] python/qemu/qmp: assert sockfile is not None

Message ID 20200531163846.25363-17-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/25] scripts/qemugdb: Remove shebang header | expand

Commit Message

Philippe Mathieu-Daudé May 31, 2020, 4:38 p.m. UTC
From: John Snow <jsnow@redhat.com>

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 | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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 @@  def __negotiate_capabilities(self):
         raise QMPCapabilitiesError
 
     def __json_read(self, only_event=False):
+        assert self.__sockfile is not None
         while True:
             data = self.__sockfile.readline()
             if not data: