diff options
author | Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com> | 2019-11-03 22:51:27 +0300 |
---|---|---|
committer | Steven Myint <git@stevenmyint.com> | 2019-11-03 11:51:27 -0800 |
commit | 1911c203a13826d2eb03d582d60874b91e36f4fc (patch) | |
tree | f21300c18a5780c907b5d4bcd6f06456d831d324 | |
parent | ffe938667e03b02ab8c1dfad98d30998e7d712ec (diff) | |
download | pyflakes-1911c203a13826d2eb03d582d60874b91e36f4fc.tar.gz |
Allow continue inside finally in 3.8+ (#476)
-rw-r--r-- | pyflakes/checker.py | 2 | ||||
-rw-r--r-- | pyflakes/test/test_other.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py index eca2002..c8ccf56 100644 --- a/pyflakes/checker.py +++ b/pyflakes/checker.py @@ -1738,7 +1738,7 @@ class Checker(object): break # Handle Try/TryFinally difference in Python < and >= 3.3 if hasattr(n, 'finalbody') and isinstance(node, ast.Continue): - if n_child in n.finalbody: + if n_child in n.finalbody and not PY38_PLUS: self.report(messages.ContinueInFinally, node) return if isinstance(node, ast.Continue): diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py index df2f790..282accb 100644 --- a/pyflakes/test/test_other.py +++ b/pyflakes/test/test_other.py @@ -493,8 +493,10 @@ class Test(TestCase): continue ''') + @skipIf(version_info > (3, 8), "Python <= 3.8 only") def test_continueInFinally(self): # 'continue' inside 'finally' is a special syntax error + # that is removed in 3.8 self.flakes(''' while True: try: @@ -2003,6 +2005,7 @@ class TestAsyncStatements(TestCase): ''', m.BreakOutsideLoop) @skipIf(version_info < (3, 5), 'new in Python 3.5') + @skipIf(version_info > (3, 8), "Python <= 3.8 only") def test_continueInAsyncForFinally(self): self.flakes(''' async def read_data(db): |