Commit f8c1c55172 for qemu.org

commit f8c1c551726fa679d4b7daca71f55428f561b1c2
Author: Tim Pambor <timpambor@gmail.com>
Date:   Fri Oct 2 09:04:01 2026 +0200

    iotests: annotate TestRunner.shared_self for mypy 2.4

    mypy 2.4.0 infers the unannotated class attribute "shared_self = None"
    as having type "None" and rejects the later assignment of a TestRunner
    instance in run_tests_pool():

      testrunner.py:126: error: Incompatible types in assignment
      (expression has type "TestRunner", variable has type "None")

    Earlier mypy versions treated the attribute as a partial type and
    accepted the assignment. Give the attribute an explicit
    Optional['TestRunner'] annotation so both old and new mypy agree.

    Fixes tests/linters.py::TestLinters::test_mypy_iotests with mypy >= 2.4.

    Signed-off-by: Tim Pambor <timpambor@gmail.com>
    Message-ID: <20261002-mypy-2-4-v1-1-185c406d1cbd@gmail.com>
    Reviewed-by: Kevin Wolf <kwolf@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>

diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index cc36867719..729680da4a 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -108,7 +108,7 @@ def __init__(self, status: str, description: str = '',


 class TestRunner(contextlib.AbstractContextManager['TestRunner']):
-    shared_self = None
+    shared_self: Optional['TestRunner'] = None

     @staticmethod
     def proc_run_test(test: str, test_field_width: int) -> TestResult: