summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-11-22 18:26:13 (GMT)
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-12-02 16:56:54 (GMT)
commita0f09e23dd19f0cf223034f9b787a4f038cd995d (patch)
treebb86c0bee0cbf73b277498aa58f62d01796c8253
parent012f13b5051ff4385542f90c9692ef4ba6450db9 (diff)
downloadghc-a0f09e23dd19f0cf223034f9b787a4f038cd995d.zip
ghc-a0f09e23dd19f0cf223034f9b787a4f038cd995d.tar.gz
ghc-a0f09e23dd19f0cf223034f9b787a4f038cd995d.tar.bz2
testsuite: Simplify Python <3.5 fallback for TextIO
(cherry picked from commit d092d8598694c23bc07cdcc504dff52fa5f33be1)
-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 a31775d..c3f3e02 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