]> git.proxmox.com Git - mirror_qemu.git/commitdiff
python/qemu/qmp.py: re-raise OSError when encountered
authorJohn Snow <jsnow@redhat.com>
Fri, 9 Oct 2020 17:51:22 +0000 (13:51 -0400)
committerJohn Snow <jsnow@redhat.com>
Tue, 20 Oct 2020 18:58:47 +0000 (14:58 -0400)
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>
python/qemu/qmp.py

index d911999da1fdb26c4da6aaeefd4b26ac6b927e9e..96456f7aa010f9091fbd3246f21b2c4980e27f8b 100644 (file)
@@ -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.