mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: Use subscriptUnknown instead of instance check.
Also adds a test for decomposing the unknown value of `a`.
This commit is contained in:
@@ -519,7 +519,7 @@ cached module PointsToInternal {
|
||||
sequence_index_points_to(rhs, context, sequence, value, index)
|
||||
or
|
||||
pointsTo(rhs, context, sequence, _) and
|
||||
sequence instanceof UnknownInstanceInternal and
|
||||
sequence.subscriptUnknown() and
|
||||
value = TUnknownInstance(ObjectInternal::builtin("object"))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@
|
||||
| a_simple.py:49 | i_0 = c |
|
||||
| a_simple.py:53 | l_0 = BinaryExpr[0] |
|
||||
| a_simple.py:53 | m_0 = BinaryExpr[1] |
|
||||
| a_simple.py:56 | s_0 = a[0] |
|
||||
| a_simple.py:56 | u_0 = a[1] |
|
||||
| b_condition.py:0 | __name___0 = ScopeEntryDefinition |
|
||||
| b_condition.py:0 | __package___0 = ScopeEntryDefinition |
|
||||
| b_condition.py:0 | double_attr_check_0 = ScopeEntryDefinition |
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
| a_simple.py:49 | Local Variable i | AssignmentDefinition |
|
||||
| a_simple.py:53 | Local Variable l | MultiAssignmentDefinition |
|
||||
| a_simple.py:53 | Local Variable m | MultiAssignmentDefinition |
|
||||
| a_simple.py:56 | Local Variable s | MultiAssignmentDefinition |
|
||||
| a_simple.py:56 | Local Variable u | MultiAssignmentDefinition |
|
||||
| b_condition.py:0 | Global Variable __name__ | ScopeEntryDefinition |
|
||||
| b_condition.py:0 | Global Variable __package__ | ScopeEntryDefinition |
|
||||
| b_condition.py:0 | Global Variable double_attr_check | ScopeEntryDefinition |
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
| a_simple.py:50 | ControlFlowNode for g | 38 |
|
||||
| a_simple.py:51 | ControlFlowNode for h | 38 |
|
||||
| a_simple.py:52 | ControlFlowNode for i | 38 |
|
||||
| a_simple.py:56 | ControlFlowNode for a | 38 |
|
||||
| b_condition.py:5 | ControlFlowNode for IfExp | 5 |
|
||||
| b_condition.py:5 | ControlFlowNode for cond | 5 |
|
||||
| b_condition.py:5 | ControlFlowNode for unknown | 5 |
|
||||
|
||||
@@ -22,10 +22,12 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| a_simple.py:18 | ControlFlowNode for multi_loop | Function multi_loop | builtin-class function | 18 | import |
|
||||
| a_simple.py:19 | ControlFlowNode for None | NoneType None | builtin-class NoneType | 19 | runtime |
|
||||
| a_simple.py:19 | ControlFlowNode for x | NoneType None | builtin-class NoneType | 19 | runtime |
|
||||
| a_simple.py:21 | ControlFlowNode for x | x | builtin-class object | 20 | runtime |
|
||||
| a_simple.py:23 | ControlFlowNode for FunctionExpr | Function with_definition | builtin-class function | 23 | import |
|
||||
| a_simple.py:23 | ControlFlowNode for with_definition | Function with_definition | builtin-class function | 23 | import |
|
||||
| a_simple.py:27 | ControlFlowNode for FunctionExpr | Function multi_loop_in_try | builtin-class function | 27 | import |
|
||||
| a_simple.py:27 | ControlFlowNode for multi_loop_in_try | Function multi_loop_in_try | builtin-class function | 27 | import |
|
||||
| a_simple.py:30 | ControlFlowNode for p | p | builtin-class object | 29 | runtime |
|
||||
| a_simple.py:31 | ControlFlowNode for KeyError | builtin-class KeyError | builtin-class type | 31 | runtime |
|
||||
| a_simple.py:34 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 34 | import |
|
||||
| a_simple.py:34 | ControlFlowNode for args | args | builtin-class tuple | 34 | runtime |
|
||||
@@ -75,6 +77,8 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| a_simple.py:53 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 53 | runtime |
|
||||
| a_simple.py:54 | ControlFlowNode for l | l | builtin-class object | 53 | runtime |
|
||||
| a_simple.py:55 | ControlFlowNode for m | m | builtin-class object | 53 | runtime |
|
||||
| a_simple.py:57 | ControlFlowNode for s | s | builtin-class object | 56 | runtime |
|
||||
| a_simple.py:58 | ControlFlowNode for u | u | builtin-class object | 56 | runtime |
|
||||
| b_condition.py:4 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 4 | import |
|
||||
| b_condition.py:4 | ControlFlowNode for f | Function f | builtin-class function | 4 | import |
|
||||
| b_condition.py:5 | ControlFlowNode for IfExp | NoneType None | builtin-class NoneType | 5 | runtime |
|
||||
@@ -1080,6 +1084,7 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| r_regressions.py:42 | ControlFlowNode for FunctionExpr | Function find_library | builtin-class function | 42 | import |
|
||||
| r_regressions.py:42 | ControlFlowNode for find_library | Function find_library | builtin-class function | 42 | import |
|
||||
| r_regressions.py:43 | ControlFlowNode for List | List | builtin-class list | 43 | runtime |
|
||||
| r_regressions.py:44 | ControlFlowNode for data | data | builtin-class object | 43 | runtime |
|
||||
| r_regressions.py:46 | ControlFlowNode for FunctionExpr | Function fail | builtin-class function | 46 | import |
|
||||
| r_regressions.py:46 | ControlFlowNode for fail | Function fail | builtin-class function | 46 | import |
|
||||
| r_regressions.py:49 | ControlFlowNode for C | class C | builtin-class type | 49 | import |
|
||||
|
||||
@@ -22,10 +22,12 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| a_simple.py:18 | ControlFlowNode for multi_loop | Function multi_loop | builtin-class function | 18 |
|
||||
| a_simple.py:19 | ControlFlowNode for None | NoneType None | builtin-class NoneType | 19 |
|
||||
| a_simple.py:19 | ControlFlowNode for x | NoneType None | builtin-class NoneType | 19 |
|
||||
| a_simple.py:21 | ControlFlowNode for x | x | builtin-class object | 20 |
|
||||
| a_simple.py:23 | ControlFlowNode for FunctionExpr | Function with_definition | builtin-class function | 23 |
|
||||
| a_simple.py:23 | ControlFlowNode for with_definition | Function with_definition | builtin-class function | 23 |
|
||||
| a_simple.py:27 | ControlFlowNode for FunctionExpr | Function multi_loop_in_try | builtin-class function | 27 |
|
||||
| a_simple.py:27 | ControlFlowNode for multi_loop_in_try | Function multi_loop_in_try | builtin-class function | 27 |
|
||||
| a_simple.py:30 | ControlFlowNode for p | p | builtin-class object | 29 |
|
||||
| a_simple.py:31 | ControlFlowNode for KeyError | builtin-class KeyError | builtin-class type | 31 |
|
||||
| a_simple.py:34 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 34 |
|
||||
| a_simple.py:34 | ControlFlowNode for args | args | builtin-class tuple | 34 |
|
||||
@@ -75,6 +77,8 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| a_simple.py:53 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 53 |
|
||||
| a_simple.py:54 | ControlFlowNode for l | l | builtin-class object | 53 |
|
||||
| a_simple.py:55 | ControlFlowNode for m | m | builtin-class object | 53 |
|
||||
| a_simple.py:57 | ControlFlowNode for s | s | builtin-class object | 56 |
|
||||
| a_simple.py:58 | ControlFlowNode for u | u | builtin-class object | 56 |
|
||||
| b_condition.py:4 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 4 |
|
||||
| b_condition.py:4 | ControlFlowNode for f | Function f | builtin-class function | 4 |
|
||||
| b_condition.py:5 | ControlFlowNode for IfExp | NoneType None | builtin-class NoneType | 5 |
|
||||
|
||||
@@ -51,7 +51,9 @@
|
||||
| a_simple.py:38 | Local Variable p | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable q | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable r | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable s | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable t | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable u | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable w | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable x | Entry node for Function multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable y | Entry node for Function multi_assign_and_packing | definition |
|
||||
@@ -69,6 +71,8 @@
|
||||
| a_simple.py:49 | Local Variable i | ControlFlowNode for i | definition |
|
||||
| a_simple.py:53 | Local Variable l | ControlFlowNode for l | definition |
|
||||
| a_simple.py:53 | Local Variable m | ControlFlowNode for m | definition |
|
||||
| a_simple.py:56 | Local Variable s | ControlFlowNode for s | definition |
|
||||
| a_simple.py:56 | Local Variable u | ControlFlowNode for u | definition |
|
||||
| b_condition.py:0 | Global Variable __name__ | Entry node for Module code.b_condition | definition |
|
||||
| b_condition.py:0 | Global Variable __package__ | Entry node for Module code.b_condition | definition |
|
||||
| b_condition.py:0 | Global Variable double_attr_check | Entry node for Module code.b_condition | definition |
|
||||
|
||||
@@ -67,7 +67,9 @@
|
||||
| a_simple.py:38 | p_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | q_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | r_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | s_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | t_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | u_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | w_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | x_0 | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | y_0 | Exit node for Function multi_assign_and_packing |
|
||||
@@ -91,6 +93,9 @@
|
||||
| a_simple.py:52 | i_0 | ControlFlowNode for i |
|
||||
| a_simple.py:54 | l_0 | ControlFlowNode for l |
|
||||
| a_simple.py:55 | m_0 | ControlFlowNode for m |
|
||||
| a_simple.py:56 | a_0 | ControlFlowNode for a |
|
||||
| a_simple.py:57 | s_0 | ControlFlowNode for s |
|
||||
| a_simple.py:58 | u_0 | ControlFlowNode for u |
|
||||
| b_condition.py:0 | __name___0 | Exit node for Module code.b_condition |
|
||||
| b_condition.py:0 | __package___0 | Exit node for Module code.b_condition |
|
||||
| b_condition.py:0 | double_attr_check_1 | Exit node for Module code.b_condition |
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
| a_simple.py:16 | ControlFlowNode for d | runtime | instance of dict | builtin-class dict |
|
||||
| a_simple.py:18 | ControlFlowNode for FunctionExpr | import | Function multi_loop | builtin-class function |
|
||||
| a_simple.py:19 | ControlFlowNode for None | runtime | None | builtin-class NoneType |
|
||||
| a_simple.py:21 | ControlFlowNode for x | runtime | instance of object | builtin-class object |
|
||||
| a_simple.py:23 | ControlFlowNode for FunctionExpr | import | Function with_definition | builtin-class function |
|
||||
| a_simple.py:27 | ControlFlowNode for FunctionExpr | import | Function multi_loop_in_try | builtin-class function |
|
||||
| a_simple.py:30 | ControlFlowNode for p | runtime | instance of object | builtin-class object |
|
||||
| a_simple.py:31 | ControlFlowNode for KeyError | runtime | builtin-class KeyError | builtin-class type |
|
||||
| a_simple.py:34 | ControlFlowNode for FunctionExpr | import | Function f | builtin-class function |
|
||||
| a_simple.py:35 | ControlFlowNode for IntegerLiteral | runtime | int 0 | builtin-class int |
|
||||
@@ -61,6 +63,8 @@
|
||||
| a_simple.py:53 | ControlFlowNode for Tuple | runtime | (int 2, ) | builtin-class tuple |
|
||||
| a_simple.py:54 | ControlFlowNode for l | runtime | instance of object | builtin-class object |
|
||||
| a_simple.py:55 | ControlFlowNode for m | runtime | instance of object | builtin-class object |
|
||||
| a_simple.py:57 | ControlFlowNode for s | runtime | instance of object | builtin-class object |
|
||||
| a_simple.py:58 | ControlFlowNode for u | runtime | instance of object | builtin-class object |
|
||||
| b_condition.py:4 | ControlFlowNode for FunctionExpr | import | Function f | builtin-class function |
|
||||
| b_condition.py:5 | ControlFlowNode for IfExp | runtime | None | builtin-class NoneType |
|
||||
| b_condition.py:5 | ControlFlowNode for None | runtime | None | builtin-class NoneType |
|
||||
@@ -866,6 +870,7 @@
|
||||
| r_regressions.py:36 | ControlFlowNode for z | runtime | int 0 | builtin-class int |
|
||||
| r_regressions.py:42 | ControlFlowNode for FunctionExpr | import | Function find_library | builtin-class function |
|
||||
| r_regressions.py:43 | ControlFlowNode for List | runtime | List | builtin-class list |
|
||||
| r_regressions.py:44 | ControlFlowNode for data | runtime | instance of object | builtin-class object |
|
||||
| r_regressions.py:46 | ControlFlowNode for FunctionExpr | import | Function fail | builtin-class function |
|
||||
| r_regressions.py:49 | ControlFlowNode for ClassExpr | import | class C | builtin-class type |
|
||||
| r_regressions.py:49 | ControlFlowNode for object | import | builtin-class object | builtin-class type |
|
||||
|
||||
@@ -52,7 +52,9 @@
|
||||
| a_simple.py:38 | p | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | q | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | r | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | s | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | t | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | u | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | w | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | x | Exit node for Function multi_assign_and_packing |
|
||||
| a_simple.py:38 | y | Exit node for Function multi_assign_and_packing |
|
||||
@@ -76,6 +78,9 @@
|
||||
| a_simple.py:52 | i | ControlFlowNode for i |
|
||||
| a_simple.py:54 | l | ControlFlowNode for l |
|
||||
| a_simple.py:55 | m | ControlFlowNode for m |
|
||||
| a_simple.py:56 | a | ControlFlowNode for a |
|
||||
| a_simple.py:57 | s | ControlFlowNode for s |
|
||||
| a_simple.py:58 | u | ControlFlowNode for u |
|
||||
| b_condition.py:0 | Exception | Exit node for Module code.b_condition |
|
||||
| b_condition.py:0 | TypeError | Exit node for Module code.b_condition |
|
||||
| b_condition.py:0 | __name__ | Exit node for Module code.b_condition |
|
||||
|
||||
@@ -53,3 +53,7 @@ def multi_assign_and_packing(a, b="b", c="c"):
|
||||
l, m = (1,) + (2,)
|
||||
l
|
||||
m
|
||||
s, u = a
|
||||
s
|
||||
u
|
||||
|
||||
|
||||
Reference in New Issue
Block a user