Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 73fe596

Browse files
committed
Python: type-tracking through dictionary construction
1 parent ece8245 commit 73fe596

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ predicate jumpStepNotSharedWithTypeTracker(Node nodeFrom, Node nodeTo) {
646646
*/
647647
predicate storeStepCommon(Node nodeFrom, ContentSet c, Node nodeTo) {
648648
tupleStoreStep(nodeFrom, c, nodeTo)
649+
or
650+
dictStoreStep(nodeFrom, c, nodeTo)
649651
}
650652

651653
/**
@@ -659,8 +661,6 @@ predicate storeStep(Node nodeFrom, ContentSet c, Node nodeTo) {
659661
or
660662
setStoreStep(nodeFrom, c, nodeTo)
661663
or
662-
dictStoreStep(nodeFrom, c, nodeTo)
663-
or
664664
moreDictStoreSteps(nodeFrom, c, nodeTo)
665665
or
666666
comprehensionStoreStep(nodeFrom, c, nodeTo)

python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ typeTracker_found_pointsTo_notFound
3838
| code/class_super.py:101:1:101:7 | ControlFlowNode for Attribute() | Z.foo |
3939
| code/class_super.py:108:1:108:8 | ControlFlowNode for Attribute() | Z.foo |
4040
| code/def_in_function.py:22:5:22:11 | ControlFlowNode for Attribute() | test.A.foo |
41+
| code/func_ref_in_content.py:29:1:29:4 | ControlFlowNode for f4() | func |
4142
| code/isinstance.py:9:13:9:22 | ControlFlowNode for Attribute() | A.foo |
4243
| code/isinstance.py:9:13:9:22 | ControlFlowNode for Attribute() | ASub.foo |
4344
| code/isinstance.py:14:13:14:22 | ControlFlowNode for Attribute() | A.foo |

python/ql/test/experimental/library-tests/CallGraph/code/func_ref_in_content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def return_func_in_dict():
2626
dct = return_func_in_dict() # $ pt,tt=return_func_in_dict
2727

2828
f4 = dct['func']
29-
f4() # $ MISSING: tt=func
29+
f4() # $ tt=func
3030

3131

3232
def return_func_in_dict_update():

0 commit comments

Comments
 (0)