diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg index 727f16efab..943085aeb7 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg @@ -168,7 +168,7 @@ class LeafListener(MockListener): >> WalkListener(s) ::= << -if __name__ is not None and "." in __name__: +if "." in __name__: from .TListener import TListener else: from TListener import TListener 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 e06b57ba2d..972b88b6d0 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 @@ -65,7 +65,7 @@ else: ListenerFile(file, header, namedActions) ::= << from antlr4 import * -if __name__ is not None and "." in __name__: +if "." in __name__: from . import else: from import @@ -92,7 +92,7 @@ del VisitorFile(file, header, namedActions) ::= << from antlr4 import * -if __name__ is not None and "." in __name__: +if "." in __name__: from . import else: from import @@ -123,7 +123,7 @@ Parser(parser, funcs, atn, sempredFuncs, superClass) ::= << Parser_(parser, funcs, atn, sempredFuncs, ctor, superClass) ::= << -if __name__ is not None and "." in __name__: +if "." in __name__: from . import else: from import @@ -773,7 +773,7 @@ else: Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= << -if __name__ is not None and "." in __name__: +if "." in __name__: from . import else: from import