Skip to content

Commit 92729db

Browse files
committed
Python: Support iterable unpacking in type-tracking
1 parent 0cf3fe4 commit 92729db

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@ predicate storeStepCommon(Node nodeFrom, ContentSet c, Node nodeTo) {
650650
dictStoreStep(nodeFrom, c, nodeTo)
651651
or
652652
moreDictStoreSteps(nodeFrom, c, nodeTo)
653+
or
654+
iterableUnpackingStoreStep(nodeFrom, c, nodeTo)
653655
}
654656

655657
/**
@@ -665,8 +667,6 @@ predicate storeStep(Node nodeFrom, ContentSet c, Node nodeTo) {
665667
or
666668
comprehensionStoreStep(nodeFrom, c, nodeTo)
667669
or
668-
iterableUnpackingStoreStep(nodeFrom, c, nodeTo)
669-
or
670670
attributeStoreStep(nodeFrom, c, nodeTo)
671671
or
672672
matchStoreStep(nodeFrom, c, nodeTo)
@@ -903,6 +903,8 @@ predicate attributeStoreStep(Node nodeFrom, AttributeContent c, Node nodeTo) {
903903
*/
904904
predicate readStepCommon(Node nodeFrom, ContentSet c, Node nodeTo) {
905905
subscriptReadStep(nodeFrom, c, nodeTo)
906+
or
907+
iterableUnpackingReadStep(nodeFrom, c, nodeTo)
906908
}
907909

908910
/**
@@ -911,8 +913,6 @@ predicate readStepCommon(Node nodeFrom, ContentSet c, Node nodeTo) {
911913
predicate readStep(Node nodeFrom, ContentSet c, Node nodeTo) {
912914
readStepCommon(nodeFrom, c, nodeTo)
913915
or
914-
iterableUnpackingReadStep(nodeFrom, c, nodeTo)
915-
or
916916
matchReadStep(nodeFrom, c, nodeTo)
917917
or
918918
forReadStep(nodeFrom, c, nodeTo)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pointsTo_found_typeTracker_notFound
1515
| code/func_defined_outside_class.py:39:11:39:21 | ControlFlowNode for _gen() | B._gen |
1616
| code/func_defined_outside_class.py:42:1:42:7 | ControlFlowNode for Attribute() | B._gen.func |
1717
| code/func_defined_outside_class.py:43:1:43:7 | ControlFlowNode for Attribute() | B._gen.func |
18-
| code/func_ref_in_content.py:20:1:20:4 | ControlFlowNode for f2() | func |
1918
| code/funky_regression.py:15:9:15:17 | ControlFlowNode for Attribute() | Wat.f2 |
2019
| code/type_tracking_limitation.py:8:1:8:3 | ControlFlowNode for x() | my_func |
2120
typeTracker_found_pointsTo_notFound

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
@@ -17,7 +17,7 @@ def return_func_in_tuple():
1717
tup = return_func_in_tuple() # $ pt,tt=return_func_in_tuple
1818

1919
f2, _ = tup
20-
f2() # $ pt=func MISSING: tt
20+
f2() # $ pt,tt=func
2121

2222
f3 = tup[0]
2323
f3() # $ tt,pt=func

0 commit comments

Comments
 (0)