@@ -32,7 +32,7 @@
from types import TracebackType
from . import qmp
-from .qmp import SocketAddrT
+from .qmp import SocketAddrT, QMPMessage
LOG = logging.getLogger(__name__)
@@ -553,6 +553,8 @@ def _match(event):
return True
return False
+ event: Optional[QMPMessage]
+
# Search cached events
for event in self._events:
if _match(event):
@@ -562,6 +564,8 @@ def _match(event):
# Poll for new events
while True:
event = self._qmp.pull_event(wait=timeout)
+ if event is None:
+ break
if _match(event):
return event
self._events.append(event)
If the timeout is 0, we can get None back. Handle this explicitly. Signed-off-by: John Snow <jsnow@redhat.com> --- python/qemu/machine.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)