summaryrefslogtreecommitdiff
path: root/pyflakes/checker.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2023-04-25 19:37:22 -0400
committerGitHub <noreply@github.com>2023-04-25 19:37:22 -0400
commitf2671ffe1785754f0e73d148635cbb38e673e169 (patch)
treefb016eca14a15499437cf9e3785a8330066dca2f /pyflakes/checker.py
parente19886e583637a7e2eec428cc036094b9630f2d0 (diff)
downloadpyflakes-main.tar.gz
allow redefinition of functions across match arms (#772)HEADmain
Diffstat (limited to 'pyflakes/checker.py')
-rw-r--r--pyflakes/checker.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index e654afa..db4da49 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -29,8 +29,10 @@ parse_format_string = string.Formatter().parse
def getAlternatives(n):
if isinstance(n, ast.If):
return [n.body]
- if isinstance(n, ast.Try):
+ elif isinstance(n, ast.Try):
return [n.body + n.orelse] + [[hdl] for hdl in n.handlers]
+ elif sys.version_info >= (3, 10) and isinstance(n, ast.Match):
+ return [mc.body for mc in n.cases]
FOR_TYPES = (ast.For, ast.AsyncFor)