summaryrefslogtreecommitdiff
path: root/testsuite/driver/my_typing.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/driver/my_typing.py')
-rw-r--r--testsuite/driver/my_typing.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/testsuite/driver/my_typing.py b/testsuite/driver/my_typing.py
index a31775d7f2..c3f3e02fe7 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