Skip to content

Commit 3d7b897

Browse files
committed
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 <[email protected]>
1 parent 97c81ef commit 3d7b897

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

python/qemu/qmp/qmp_tui.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ async def manage_connection(self) -> None:
346346
self._set_status('[Disconnected]')
347347
await self.disconnect()
348348
# check if a retry is needed
349-
if self.runstate == Runstate.IDLE:
349+
# mypy 1.4.0 doesn't believe runstate can change after
350+
# disconnect(), hence the cast.
351+
state = cast(Runstate, self.runstate)
352+
if state == Runstate.IDLE:
350353
continue
351354
await self.runstate_changed()
352355

python/setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ devel =
3939
flake8 >= 5.0.4
4040
fusepy >= 2.0.4
4141
isort >= 5.1.2
42-
mypy >= 0.780
42+
mypy >= 1.4.0
4343
pylint >= 2.17.3
4444
tox >= 3.18.0
4545
urwid >= 2.1.2

python/tests/minreqs.txt

+4-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ avocado-framework==90.0
2828
# Linters
2929
flake8==5.0.4
3030
isort==5.1.2
31-
mypy==0.780
31+
mypy==1.4.0
3232
pylint==2.17.3
3333

3434
# Transitive flake8 dependencies
@@ -37,12 +37,11 @@ pycodestyle==2.9.1
3737
pyflakes==2.5.0
3838

3939
# Transitive mypy dependencies
40-
mypy-extensions==0.4.3
41-
typed-ast==1.4.0
42-
typing-extensions==4.5.0
40+
mypy-extensions==1.0.0
41+
typing-extensions==4.7.1
4342

4443
# Transitive pylint dependencies
4544
astroid==2.15.4
4645
lazy-object-proxy==1.4.0
4746
toml==0.10.0
48-
wrapt==1.12.1
47+
wrapt==1.14.0

0 commit comments

Comments
 (0)