Skip to content

Commit 5c90bec

Browse files
committed
Python: Use TUnknown instead of TUnknownInstance.
1 parent 115bbf6 commit 5c90bec

File tree

6 files changed

+9
-22
lines changed

6 files changed

+9
-22
lines changed

python/ql/src/semmle/python/pointsto/PointsTo.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ cached module PointsToInternal {
520520
or
521521
pointsTo(rhs, context, sequence, _) and
522522
sequence.subscriptUnknown() and
523-
value = TUnknownInstance(ObjectInternal::builtin("object"))
523+
value = TUnknown()
524524
)
525525
}
526526

python/ql/test/library-tests/PointsTo/new/PointsToUnknown.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
| a_simple.py:20 | ControlFlowNode for For | 20 |
22
| a_simple.py:20 | ControlFlowNode for seq | 18 |
3+
| a_simple.py:21 | ControlFlowNode for x | 20 |
34
| a_simple.py:24 | ControlFlowNode for x | 23 |
45
| a_simple.py:29 | ControlFlowNode for For | 29 |
56
| a_simple.py:29 | ControlFlowNode for x | 27 |
7+
| a_simple.py:30 | ControlFlowNode for p | 29 |
68
| a_simple.py:35 | ControlFlowNode for Subscript | 35 |
79
| a_simple.py:36 | ControlFlowNode for Subscript | 36 |
810
| a_simple.py:40 | ControlFlowNode for a | 38 |
@@ -17,7 +19,11 @@
1719
| a_simple.py:50 | ControlFlowNode for g | 38 |
1820
| a_simple.py:51 | ControlFlowNode for h | 38 |
1921
| a_simple.py:52 | ControlFlowNode for i | 38 |
22+
| a_simple.py:54 | ControlFlowNode for l | 53 |
23+
| a_simple.py:55 | ControlFlowNode for m | 53 |
2024
| a_simple.py:56 | ControlFlowNode for a | 38 |
25+
| a_simple.py:57 | ControlFlowNode for s | 56 |
26+
| a_simple.py:58 | ControlFlowNode for u | 56 |
2127
| b_condition.py:5 | ControlFlowNode for IfExp | 5 |
2228
| b_condition.py:5 | ControlFlowNode for cond | 5 |
2329
| b_condition.py:5 | ControlFlowNode for unknown | 5 |
@@ -235,6 +241,7 @@
235241
| r_regressions.py:39 | ControlFlowNode for y | 27 |
236242
| r_regressions.py:43 | ControlFlowNode for x | 43 |
237243
| r_regressions.py:43 | ControlFlowNode for x() | 43 |
244+
| r_regressions.py:44 | ControlFlowNode for data | 43 |
238245
| r_regressions.py:52 | ControlFlowNode for msg | 51 |
239246
| r_regressions.py:64 | ControlFlowNode for do_validation | 64 |
240247
| r_regressions.py:64 | ControlFlowNode for do_validation() | 64 |

python/ql/test/library-tests/PointsTo/new/PointsToWithContext.expected

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
2222
| a_simple.py:18 | ControlFlowNode for multi_loop | Function multi_loop | builtin-class function | 18 | import |
2323
| a_simple.py:19 | ControlFlowNode for None | NoneType None | builtin-class NoneType | 19 | runtime |
2424
| a_simple.py:19 | ControlFlowNode for x | NoneType None | builtin-class NoneType | 19 | runtime |
25-
| a_simple.py:21 | ControlFlowNode for x | x | builtin-class object | 20 | runtime |
2625
| a_simple.py:23 | ControlFlowNode for FunctionExpr | Function with_definition | builtin-class function | 23 | import |
2726
| a_simple.py:23 | ControlFlowNode for with_definition | Function with_definition | builtin-class function | 23 | import |
2827
| a_simple.py:27 | ControlFlowNode for FunctionExpr | Function multi_loop_in_try | builtin-class function | 27 | import |
2928
| a_simple.py:27 | ControlFlowNode for multi_loop_in_try | Function multi_loop_in_try | builtin-class function | 27 | import |
30-
| a_simple.py:30 | ControlFlowNode for p | p | builtin-class object | 29 | runtime |
3129
| a_simple.py:31 | ControlFlowNode for KeyError | builtin-class KeyError | builtin-class type | 31 | runtime |
3230
| a_simple.py:34 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 34 | import |
3331
| a_simple.py:34 | ControlFlowNode for args | args | builtin-class tuple | 34 | runtime |
@@ -75,10 +73,6 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
7573
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | int 2 | builtin-class int | 53 | runtime |
7674
| a_simple.py:53 | ControlFlowNode for Tuple | BinaryExpr | builtin-class tuple | 53 | runtime |
7775
| a_simple.py:53 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 53 | runtime |
78-
| a_simple.py:54 | ControlFlowNode for l | l | builtin-class object | 53 | runtime |
79-
| a_simple.py:55 | ControlFlowNode for m | m | builtin-class object | 53 | runtime |
80-
| a_simple.py:57 | ControlFlowNode for s | s | builtin-class object | 56 | runtime |
81-
| a_simple.py:58 | ControlFlowNode for u | u | builtin-class object | 56 | runtime |
8276
| b_condition.py:4 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 4 | import |
8377
| b_condition.py:4 | ControlFlowNode for f | Function f | builtin-class function | 4 | import |
8478
| b_condition.py:5 | ControlFlowNode for IfExp | NoneType None | builtin-class NoneType | 5 | runtime |
@@ -1084,7 +1078,6 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
10841078
| r_regressions.py:42 | ControlFlowNode for FunctionExpr | Function find_library | builtin-class function | 42 | import |
10851079
| r_regressions.py:42 | ControlFlowNode for find_library | Function find_library | builtin-class function | 42 | import |
10861080
| r_regressions.py:43 | ControlFlowNode for List | List | builtin-class list | 43 | runtime |
1087-
| r_regressions.py:44 | ControlFlowNode for data | data | builtin-class object | 43 | runtime |
10881081
| r_regressions.py:46 | ControlFlowNode for FunctionExpr | Function fail | builtin-class function | 46 | import |
10891082
| r_regressions.py:46 | ControlFlowNode for fail | Function fail | builtin-class function | 46 | import |
10901083
| r_regressions.py:49 | ControlFlowNode for C | class C | builtin-class type | 49 | import |

python/ql/test/library-tests/PointsTo/new/PointsToWithType.expected

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
2222
| a_simple.py:18 | ControlFlowNode for multi_loop | Function multi_loop | builtin-class function | 18 |
2323
| a_simple.py:19 | ControlFlowNode for None | NoneType None | builtin-class NoneType | 19 |
2424
| a_simple.py:19 | ControlFlowNode for x | NoneType None | builtin-class NoneType | 19 |
25-
| a_simple.py:21 | ControlFlowNode for x | x | builtin-class object | 20 |
2625
| a_simple.py:23 | ControlFlowNode for FunctionExpr | Function with_definition | builtin-class function | 23 |
2726
| a_simple.py:23 | ControlFlowNode for with_definition | Function with_definition | builtin-class function | 23 |
2827
| a_simple.py:27 | ControlFlowNode for FunctionExpr | Function multi_loop_in_try | builtin-class function | 27 |
2928
| a_simple.py:27 | ControlFlowNode for multi_loop_in_try | Function multi_loop_in_try | builtin-class function | 27 |
30-
| a_simple.py:30 | ControlFlowNode for p | p | builtin-class object | 29 |
3129
| a_simple.py:31 | ControlFlowNode for KeyError | builtin-class KeyError | builtin-class type | 31 |
3230
| a_simple.py:34 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 34 |
3331
| a_simple.py:34 | ControlFlowNode for args | args | builtin-class tuple | 34 |
@@ -75,10 +73,6 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
7573
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | int 2 | builtin-class int | 53 |
7674
| a_simple.py:53 | ControlFlowNode for Tuple | BinaryExpr | builtin-class tuple | 53 |
7775
| a_simple.py:53 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 53 |
78-
| a_simple.py:54 | ControlFlowNode for l | l | builtin-class object | 53 |
79-
| a_simple.py:55 | ControlFlowNode for m | m | builtin-class object | 53 |
80-
| a_simple.py:57 | ControlFlowNode for s | s | builtin-class object | 56 |
81-
| a_simple.py:58 | ControlFlowNode for u | u | builtin-class object | 56 |
8276
| b_condition.py:4 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 4 |
8377
| b_condition.py:4 | ControlFlowNode for f | Function f | builtin-class function | 4 |
8478
| b_condition.py:5 | ControlFlowNode for IfExp | NoneType None | builtin-class NoneType | 5 |

python/ql/test/library-tests/PointsTo/new/Values.expected

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
| a_simple.py:16 | ControlFlowNode for d | runtime | instance of dict | builtin-class dict |
1212
| a_simple.py:18 | ControlFlowNode for FunctionExpr | import | Function multi_loop | builtin-class function |
1313
| a_simple.py:19 | ControlFlowNode for None | runtime | None | builtin-class NoneType |
14-
| a_simple.py:21 | ControlFlowNode for x | runtime | instance of object | builtin-class object |
1514
| a_simple.py:23 | ControlFlowNode for FunctionExpr | import | Function with_definition | builtin-class function |
1615
| a_simple.py:27 | ControlFlowNode for FunctionExpr | import | Function multi_loop_in_try | builtin-class function |
17-
| a_simple.py:30 | ControlFlowNode for p | runtime | instance of object | builtin-class object |
1816
| a_simple.py:31 | ControlFlowNode for KeyError | runtime | builtin-class KeyError | builtin-class type |
1917
| a_simple.py:34 | ControlFlowNode for FunctionExpr | import | Function f | builtin-class function |
2018
| a_simple.py:35 | ControlFlowNode for IntegerLiteral | runtime | int 0 | builtin-class int |
@@ -61,10 +59,6 @@
6159
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | runtime | int 2 | builtin-class int |
6260
| a_simple.py:53 | ControlFlowNode for Tuple | runtime | (int 1, ) | builtin-class tuple |
6361
| a_simple.py:53 | ControlFlowNode for Tuple | runtime | (int 2, ) | builtin-class tuple |
64-
| a_simple.py:54 | ControlFlowNode for l | runtime | instance of object | builtin-class object |
65-
| a_simple.py:55 | ControlFlowNode for m | runtime | instance of object | builtin-class object |
66-
| a_simple.py:57 | ControlFlowNode for s | runtime | instance of object | builtin-class object |
67-
| a_simple.py:58 | ControlFlowNode for u | runtime | instance of object | builtin-class object |
6862
| b_condition.py:4 | ControlFlowNode for FunctionExpr | import | Function f | builtin-class function |
6963
| b_condition.py:5 | ControlFlowNode for IfExp | runtime | None | builtin-class NoneType |
7064
| b_condition.py:5 | ControlFlowNode for None | runtime | None | builtin-class NoneType |
@@ -870,7 +864,6 @@
870864
| r_regressions.py:36 | ControlFlowNode for z | runtime | int 0 | builtin-class int |
871865
| r_regressions.py:42 | ControlFlowNode for FunctionExpr | import | Function find_library | builtin-class function |
872866
| r_regressions.py:43 | ControlFlowNode for List | runtime | List | builtin-class list |
873-
| r_regressions.py:44 | ControlFlowNode for data | runtime | instance of object | builtin-class object |
874867
| r_regressions.py:46 | ControlFlowNode for FunctionExpr | import | Function fail | builtin-class function |
875868
| r_regressions.py:49 | ControlFlowNode for ClassExpr | import | class C | builtin-class type |
876869
| r_regressions.py:49 | ControlFlowNode for object | import | builtin-class object | builtin-class type |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
| test.py:5:7:5:9 | ControlFlowNode for foo | int 42 |
22
| test.py:11:11:11:13 | ControlFlowNode for foo | int 1 |
3-
| test.py:17:11:17:13 | ControlFlowNode for foo | <MISSING pointsTo()> |
3+
| test.py:17:11:17:13 | ControlFlowNode for foo | int 2 |

0 commit comments

Comments
 (0)