summaryrefslogtreecommitdiff
path: root/testsuite/driver
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-11-22 13:26:13 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-12-02 11:56:54 -0500
commita0f09e23dd19f0cf223034f9b787a4f038cd995d (patch)
treebb86c0bee0cbf73b277498aa58f62d01796c8253 /testsuite/driver
parent012f13b5051ff4385542f90c9692ef4ba6450db9 (diff)
downloadhaskell-a0f09e23dd19f0cf223034f9b787a4f038cd995d.tar.gz
testsuite: Simplify Python <3.5 fallback for TextIO
(cherry picked from commit d092d8598694c23bc07cdcc504dff52fa5f33be1)
Diffstat (limited to 'testsuite/driver')
-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