Skip to content

Commit 30b58e7

Browse files
committed
python: control flow node ExceptGroupStmt
- wrap `getType` and `getName`, considering dominance - do not implement all the handles predicates
1 parent 9f9a962 commit 30b58e7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

python/ql/lib/semmle/python/types/Exceptions.qll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,21 @@ class ExceptFlowNode extends ControlFlowNode {
439439
}
440440
}
441441

442+
/** The ControlFlowNode for an 'except*' statement. */
443+
class ExceptGroupFlowNode extends ControlFlowNode {
444+
ExceptGroupFlowNode() { this.getNode() instanceof ExceptGroupStmt }
445+
446+
ControlFlowNode getType() {
447+
this.getBasicBlock().dominates(result.getBasicBlock()) and
448+
result = this.getNode().(ExceptGroupStmt).getType().getAFlowNode()
449+
}
450+
451+
ControlFlowNode getName() {
452+
this.getBasicBlock().dominates(result.getBasicBlock()) and
453+
result = this.getNode().(ExceptGroupStmt).getName().getAFlowNode()
454+
}
455+
}
456+
442457
private ControlFlowNode element_from_tuple_objectapi(Object tuple) {
443458
exists(Tuple t | t = tuple.getOrigin() and result = t.getAnElt().getAFlowNode())
444459
}

0 commit comments

Comments
 (0)