Skip to content

Commit

Permalink
python/qemu/qmp: assert sockfile is not None
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jnsnow authored and philmd committed May 31, 2020
1 parent 7af67d6 commit de210ec
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions python/qemu/qmp.py
Expand Up @@ -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:
Expand Down

0 comments on commit de210ec

Please sign in to comment.