python/qmp.py: Do not return None from cmd_obj
commitef5d474472426eda6abf8128cdb1d026af94862b
authorJohn Snow <jsnow@redhat.com>
Fri, 10 Jul 2020 05:22:08 +0000 (10 01:22 -0400)
committerPhilippe Mathieu-Daudé <philmd@redhat.com>
Tue, 14 Jul 2020 20:22:22 +0000 (14 22:22 +0200)
tree8466eafbd5846a9d4882d4a27d492d64d929c4b5
parente3a23b4803a3939c7e24e8946880f5ef369ef781
python/qmp.py: Do not return None from cmd_obj

This makes typing the qmp library difficult, as it necessitates wrapping
Optional[] around the type for every return type up the stack. At some
point, it becomes difficult to discern or remember why it's None instead
of the expected object.

Use the python exception system to tell us exactly why we didn't get an
object. Remove this special-cased return.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200710052220.3306-5-jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
python/qemu/qmp.py