From d092d8598694c23bc07cdcc504dff52fa5f33be1 Mon Sep 17 00:00:00 2001 From: Ben Gamari <ben@smart-cactus.org> Date: Fri, 22 Nov 2019 13:26:13 -0500 Subject: [PATCH] testsuite: Simplify Python <3.5 fallback for TextIO --- testsuite/driver/my_typing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/my_typing.py b/testsuite/driver/my_typing.py index a31775d7f2ec..c3f3e02fe77a 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 -- GitLab