From df4d8045ab02d31fc01d4f428769a2df447100a3 Mon Sep 17 00:00:00 2001 From: Taras Sotnikov Date: Tue, 2 Feb 2021 19:34:29 +0100 Subject: [PATCH 1/2] Fix TextIO compatibility with Python 3.6+ in LexerFile --- .../org/antlr/v4/tool/templates/codegen/Python3/Python3.stg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg index c4c73cac92..8b445dd792 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg @@ -756,8 +756,11 @@ LexerFile(lexerFile, lexer, namedActions) ::= << from antlr4 import * from io import StringIO -from typing.io import TextIO import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO From 98cfc0f6b87127a9445fb5f954cf4529ba573deb Mon Sep 17 00:00:00 2001 From: Taras Sotnikov Date: Tue, 2 Feb 2021 19:38:43 +0100 Subject: [PATCH 2/2] Sign contributors.txt --- contributors.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.txt b/contributors.txt index 3dcf53d07e..12dc303e0c 100644 --- a/contributors.txt +++ b/contributors.txt @@ -285,3 +285,4 @@ YYYY/MM/DD, github id, Full name, email 2020/12/01, maxence-lefebvre, Maxence Lefebvre, maxence-lefebvre@users.noreply.github.com 2020/12/03, electrum, David Phillips, david@acz.org 2021/01/25, l215884529, Qiheng Liu, 13607681+l215884529@users.noreply.github.com +2021/02/02, tsotnikov, Taras Sotnikov, taras.sotnikov@gmail.com