Skip to content

Commit 27c0571

Browse files
committed
Python points-to: Infer types for comprehensions.
1 parent 12c906c commit 27c0571

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

python/ql/src/semmle/python/objects/TObject.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ predicate literal_instantiation(ControlFlowNode n, ClassObjectInternal cls, Poin
253253
n instanceof SetNode and cls = ObjectInternal::builtin("set")
254254
or
255255
n.getNode() instanceof ImaginaryLiteral and cls = ObjectInternal::builtin("complex")
256+
or
257+
n.getNode() instanceof ListComp and cls = ObjectInternal::builtin("list")
258+
or
259+
n.getNode() instanceof SetComp and cls = ObjectInternal::builtin("set")
260+
or
261+
n.getNode() instanceof DictComp and cls = ObjectInternal::builtin("dict")
256262
)
257263
}
258264

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| 0 | 77 | 77 | 100.0 |
2-
| 1 | 5 | 43 | 11.627906976744185 |
1+
| 0 | 81 | 81 | 100.0 |
2+
| 1 | 6 | 44 | 13.636363636363637 |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| 0 | 77 | 77 | 100.0 |
2-
| 1 | 3 | 43 | 6.976744186046512 |
1+
| 0 | 81 | 81 | 100.0 |
2+
| 1 | 3 | 44 | 6.818181818181818 |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| 1231 |
1+
| 1189 |

0 commit comments

Comments
 (0)