Skip to content

Commit 76e5b59

Browse files
committed
Python: Add test case for unwanted module type tracking
1 parent b895641 commit 76e5b59

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import module.attr as attr_ref
2+
3+
x = attr_ref
4+
5+
def fun():
6+
y = attr_ref
7+
8+
# The following should _not_ be a reference to the above module, since we don't actually import it.
9+
z = module

python/ql/test/experimental/dataflow/typetracking/moduleattr.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
module_tracker
22
| import_as_attr.py:1:6:1:11 | ControlFlowNode for ImportExpr |
3+
| import_as_attr_dotted.py:0:0:0:0 | ModuleVariableNode for Global Variable attr_ref in Module import_as_attr_dotted |
4+
| import_as_attr_dotted.py:1:8:1:18 | ControlFlowNode for ImportExpr |
5+
| import_as_attr_dotted.py:1:23:1:30 | GSSA Variable attr_ref |
6+
| import_as_attr_dotted.py:3:1:3:1 | GSSA Variable x |
7+
| import_as_attr_dotted.py:3:5:3:12 | ControlFlowNode for attr_ref |
8+
| import_as_attr_dotted.py:6:5:6:5 | SSA variable y |
9+
| import_as_attr_dotted.py:6:9:6:16 | ControlFlowNode for attr_ref |
310
module_attr_tracker
411
| import_as_attr.py:0:0:0:0 | ModuleVariableNode for Global Variable attr_ref in Module import_as_attr |
512
| import_as_attr.py:1:20:1:35 | ControlFlowNode for ImportMember |

0 commit comments

Comments
 (0)