diff --git a/pylint/checkers/base/basic_error_checker.py b/pylint/checkers/base/basic_error_checker.py index ad70b26f510..38a9aa9f0e8 100644 --- a/pylint/checkers/base/basic_error_checker.py +++ b/pylint/checkers/base/basic_error_checker.py @@ -189,7 +189,6 @@ class BasicErrorChecker(_BasicChecker): "continue-in-finally", "Emitted when the `continue` keyword is found " "inside a finally clause, which is a SyntaxError.", - {"maxversion": (3, 8)}, ), "E0117": ( "nonlocal name %s found without binding", @@ -206,6 +205,10 @@ class BasicErrorChecker(_BasicChecker): ), } + def open(self) -> None: + py_version = self.linter.config.py_version + self._py38_plus = py_version >= (3, 8) + @utils.only_required_for_messages("function-redefined") def visit_classdef(self, node: nodes.ClassDef) -> None: self._check_redefinition("class", node) @@ -490,6 +493,7 @@ def _check_in_loop(self, node, node_name): isinstance(parent, nodes.TryFinally) and node in parent.finalbody and isinstance(node, nodes.Continue) + and not self._py38_plus ): self.add_message("continue-in-finally", node=node) diff --git a/tests/functional/c/continue_in_finally.rc b/tests/functional/c/continue_in_finally.rc index 67a28a36aa5..77eb3be6456 100644 --- a/tests/functional/c/continue_in_finally.rc +++ b/tests/functional/c/continue_in_finally.rc @@ -1,2 +1,2 @@ -[testoptions] -max_pyver=3.8 +[main] +py-version=3.7