summary refs log tree commit diff stats
path: root/python/qemu/qmp
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-07-05 12:40:46 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-07-07 12:49:22 +0200
commit3d7b89748afe9791a8568dfdb7d51fb2029bf8c2 (patch)
treec590f5a67be310b169eaabf8d6bd63e0af1031ae /python/qemu/qmp
parent97c81ef4b8e203d9620fd46e7eb77004563e3675 (diff)
downloadfocaccia-qemu-3d7b89748afe9791a8568dfdb7d51fb2029bf8c2.tar.gz
focaccia-qemu-3d7b89748afe9791a8568dfdb7d51fb2029bf8c2.zip
python: bump minimum requirements so they are compatible with 3.12
There are many Python 3.12 issues right now, but a particularly
problematic one when debugging them is that one cannot even use
minreqs.txt in a Python 3.12 virtual environment to test with
locked package versions.

Bump the mypy and wrapt versions to fix this, while remaining
within the realm of versions compatible with Python 3.7.

This requires a workaround for a mypy false positive

    qemu/qmp/qmp_tui.py:350: error: Non-overlapping equality check (left operand type: "Literal[Runstate.DISCONNECTING]", right operand type: "Literal[Runstate.IDLE]")  [comparison-overlap]

where mypy does not realize that self.disconnect() could change
the value of self.runstate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'python/qemu/qmp')
-rw-r--r--python/qemu/qmp/qmp_tui.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/python/qemu/qmp/qmp_tui.py b/python/qemu/qmp/qmp_tui.py
index 8369144723..2d9ebbd20b 100644
--- a/python/qemu/qmp/qmp_tui.py
+++ b/python/qemu/qmp/qmp_tui.py
@@ -346,7 +346,10 @@ class App(QMPClient):
                 self._set_status('[Disconnected]')
                 await self.disconnect()
                 # check if a retry is needed
-                if self.runstate == Runstate.IDLE:
+                # mypy 1.4.0 doesn't believe runstate can change after
+                # disconnect(), hence the cast.
+                state = cast(Runstate, self.runstate)
+                if state == Runstate.IDLE:
                     continue
             await self.runstate_changed()