diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-11-22 13:26:13 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-12-02 11:56:54 -0500 |
commit | a0f09e23dd19f0cf223034f9b787a4f038cd995d (patch) | |
tree | bb86c0bee0cbf73b277498aa58f62d01796c8253 /testsuite/driver | |
parent | 012f13b5051ff4385542f90c9692ef4ba6450db9 (diff) | |
download | haskell-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.py | 7 |
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 |