Skip to content

Commit 36f8b05

Browse files
authored
Merge pull request #10266 from yoff/python/port-CatchingBaseException
Approved by tausbn
2 parents ab296d4 + d102a84 commit 36f8b05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/ql/src/Exceptions/CatchingBaseException.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
*/
1414

1515
import python
16+
import semmle.python.ApiGraphs
1617

1718
predicate doesnt_reraise(ExceptStmt ex) { ex.getAFlowNode().getBasicBlock().reachesExit() }
1819

1920
predicate catches_base_exception(ExceptStmt ex) {
20-
ex.getType().pointsTo(ClassValue::baseException())
21+
ex.getType() = API::builtin("BaseException").getAValueReachableFromSource().asExpr()
2122
or
2223
not exists(ex.getType())
2324
}

0 commit comments

Comments
 (0)