From a0f09e23dd19f0cf223034f9b787a4f038cd995d Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 22 Nov 2019 13:26:13 -0500 Subject: testsuite: Simplify Python <3.5 fallback for TextIO (cherry picked from commit d092d8598694c23bc07cdcc504dff52fa5f33be1) --- testsuite/driver/my_typing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'testsuite/driver') 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 -- cgit v1.2.1