Fixed TextIO compatibility with 3.6+

Fixing this issue: https://github.com/antlr/antlr4/issues/2611 (and probably https://github.com/antlr/antlr4/issues/2193)
TextIO has moved since Python 3.6 so it should be imported considering the change for new versions.
This commit is contained in:
Iman Hosseini 2019-07-28 02:25:42 +04:30 committed by GitHub
parent e4737db19f
commit d667b90bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -51,8 +51,11 @@ ParserFile(file, parser, namedActions, contextSuperClass) ::= <<
# encoding: utf-8
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
<namedActions.header>
<parser>