Skip to content

Commit

Permalink
Improve Python version handling (#4726)
Browse files Browse the repository at this point in the history
Checking just the second element of a version tuple is never good style,
and it makes it less clear what actual versions of Python are in
question.

Signed-off-by: Colin Watson <[email protected]>
  • Loading branch information
cjwatson authored Nov 9, 2024
1 parent 933c4e0 commit 75befab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion runtime/Python3/src/antlr4/Lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from io import StringIO

import sys
if sys.version_info[1] > 5:
if sys.version_info >= (3, 6):
from typing import TextIO
else:
from typing.io import TextIO
Expand Down
2 changes: 1 addition & 1 deletion runtime/Python3/src/antlr4/Parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
import sys
if sys.version_info[1] > 5:
if sys.version_info >= (3, 6):
from typing import TextIO
else:
from typing.io import TextIO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ParserFile(file, parser, namedActions, contextSuperClass) ::= <<
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
if sys.version_info >= (3, 6):
from typing import TextIO
else:
from typing.io import TextIO
Expand Down Expand Up @@ -761,7 +761,7 @@ LexerFile(lexerFile, lexer, namedActions) ::= <<
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
if sys.version_info >= (3, 6):
from typing import TextIO
else:
from typing.io import TextIO
Expand Down

0 comments on commit 75befab

Please sign in to comment.