diff --git a/testsuite/driver/my_typing.py b/testsuite/driver/my_typing.py index a31775d7f2ec693e594936cb306ea795f0df9db0..c3f3e02fe77acd9401a51764a0b0f8065be28f1c 100644 --- a/testsuite/driver/my_typing.py +++ b/testsuite/driver/my_typing.py @@ -24,8 +24,11 @@ except: # is taken. We exploit this below. # TextIO is missing on some older Pythons. -if 'TextIO' in globals(): - TextIO = typing.TextIO +if 'TextIO' not in globals(): + try: + TextIO = typing.TextIO + except ImportError: + TextIO = None # type: ignore else: TextIO = None # type: ignore