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 <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>
This commit is contained in:
John Snow 2020-05-14 01:53:51 -04:00 committed by Philippe Mathieu-Daudé
parent 7af67d694e
commit de210ec53c
1 changed files with 1 additions and 0 deletions

View File

@ -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: