diff options
author | John Snow | 2020-10-09 19:51:22 +0200 |
---|---|---|
committer | John Snow | 2020-10-20 20:58:47 +0200 |
commit | d5cca076c3a1ac55f25792fae4fae2b0b1f71e8e (patch) | |
tree | 0a29e77131ac4baab5f87a44469a57f3f7c77bb9 /python/qemu | |
parent | python: add mypy config (diff) | |
download | qemu-d5cca076c3a1ac55f25792fae4fae2b0b1f71e8e.tar.gz qemu-d5cca076c3a1ac55f25792fae4fae2b0b1f71e8e.tar.xz qemu-d5cca076c3a1ac55f25792fae4fae2b0b1f71e8e.zip |
python/qemu/qmp.py: re-raise OSError when encountered
Nested if conditions don't change when the exception block fires; we
need to explicitly re-raise the error if we didn't intend to capture and
suppress it.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20201009175123.249009-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python/qemu')
-rw-r--r-- | python/qemu/qmp.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index d911999da1..96456f7aa0 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -169,10 +169,11 @@ class QEMUMonitorProtocol: try: self.__json_read() except OSError as err: - if err.errno == errno.EAGAIN: - # No data available - pass - self.__sock.setblocking(True) + # EAGAIN: No data available; not critical + if err.errno != errno.EAGAIN: + raise + finally: + self.__sock.setblocking(True) # Wait for new events, if needed. # if wait is 0.0, this means "no wait" and is also implicitly false. |