From 591640a02e0ac1c7a8277acce4a35ada7e84f4bb Mon Sep 17 00:00:00 2001 From: Taus Date: Tue, 21 Apr 2026 15:36:54 +0000 Subject: [PATCH] Python: Fix match Co-authored-by: yoff --- .../python/controlflow/internal/AstNodeImpl.qll | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/python/ql/lib/semmle/python/controlflow/internal/AstNodeImpl.qll b/python/ql/lib/semmle/python/controlflow/internal/AstNodeImpl.qll index ae2cd1d5a69..d027e518475 100644 --- a/python/ql/lib/semmle/python/controlflow/internal/AstNodeImpl.qll +++ b/python/ql/lib/semmle/python/controlflow/internal/AstNodeImpl.qll @@ -762,6 +762,20 @@ module AstSigImpl implements AstSig { result = t.getHandler(index - 1) and index >= 1 ) or + // MatchStmt: subject (0), cases (1..n) + exists(Ast::MatchStmtNode m | m = n | + index = 0 and result = m.getSubject() + or + result = m.getCase(index - 1) and index >= 1 + ) + or + // Case: guard (0), body (1) + exists(Ast::CaseNode c | c = n | + index = 0 and result = c.getGuard() + or + index = 1 and result = c.getBody() + ) + or // CatchClause (except handler): type (0), name (1), body (2) exists(Ast::ExceptionHandlerNode h | h = n | index = 0 and result = h.getType()