mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Python: Port UnreachableCode.ql
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import python
|
import python
|
||||||
private import LegacyPointsTo
|
private import semmle.python.ApiGraphs
|
||||||
|
|
||||||
predicate typing_import(ImportingStmt is) {
|
predicate typing_import(ImportingStmt is) {
|
||||||
exists(Module m |
|
exists(Module m |
|
||||||
@@ -34,11 +34,7 @@ predicate unique_yield(Stmt s) {
|
|||||||
/** Holds if `contextlib.suppress` may be used in the same scope as `s` */
|
/** Holds if `contextlib.suppress` may be used in the same scope as `s` */
|
||||||
predicate suppression_in_scope(Stmt s) {
|
predicate suppression_in_scope(Stmt s) {
|
||||||
exists(With w |
|
exists(With w |
|
||||||
w.getContextExpr()
|
w.getContextExpr() = API::moduleImport("contextlib").getMember("suppress").getACall().asExpr() and
|
||||||
.(Call)
|
|
||||||
.getFunc()
|
|
||||||
.(ExprWithPointsTo)
|
|
||||||
.pointsTo(Value::named("contextlib.suppress")) and
|
|
||||||
w.getScope() = s.getScope()
|
w.getScope() = s.getScope()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user