mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
Python: Add import regression for re-exported things
This commit is contained in:
@@ -48,6 +48,19 @@
|
||||
| bar | print | trace.py:7:1:7:27 | ControlFlowNode for FunctionExpr |
|
||||
| bar | print_function | trace.py:1:24:1:37 | ControlFlowNode for ImportMember |
|
||||
| bar | status | trace.py:23:1:23:13 | ControlFlowNode for FunctionExpr |
|
||||
| baz | __all__ | trace.py:52:11:52:46 | ControlFlowNode for List |
|
||||
| baz | __file__ | baz.py:2:7:2:14 | ControlFlowNode for __file__ |
|
||||
| baz | __file__ | baz.py:6:6:6:13 | ControlFlowNode for __file__ |
|
||||
| baz | _indent_level | trace.py:3:17:3:17 | ControlFlowNode for IntegerLiteral |
|
||||
| baz | _print | trace.py:5:10:5:14 | ControlFlowNode for print |
|
||||
| baz | _status | trace.py:21:11:21:11 | ControlFlowNode for IntegerLiteral |
|
||||
| baz | baz_attr | baz.py:4:12:4:21 | ControlFlowNode for Str |
|
||||
| baz | check | trace.py:26:1:26:61 | ControlFlowNode for FunctionExpr |
|
||||
| baz | enter | trace.py:11:1:11:21 | ControlFlowNode for FunctionExpr |
|
||||
| baz | exit | trace.py:16:1:16:20 | ControlFlowNode for FunctionExpr |
|
||||
| baz | print | trace.py:7:1:7:27 | ControlFlowNode for FunctionExpr |
|
||||
| baz | print_function | trace.py:1:24:1:37 | ControlFlowNode for ImportMember |
|
||||
| baz | status | trace.py:23:1:23:13 | ControlFlowNode for FunctionExpr |
|
||||
| foo | __all__ | trace.py:52:11:52:46 | ControlFlowNode for List |
|
||||
| foo | __file__ | foo.py:2:7:2:14 | ControlFlowNode for __file__ |
|
||||
| foo | __file__ | foo.py:14:6:14:13 | ControlFlowNode for __file__ |
|
||||
@@ -95,7 +108,7 @@
|
||||
| if_then_else_refined | status | trace.py:23:1:23:13 | ControlFlowNode for FunctionExpr |
|
||||
| main | __all__ | trace.py:52:11:52:46 | ControlFlowNode for List |
|
||||
| main | __file__ | main.py:24:7:24:14 | ControlFlowNode for __file__ |
|
||||
| main | __file__ | main.py:103:6:103:13 | ControlFlowNode for __file__ |
|
||||
| main | __file__ | main.py:107:6:107:13 | ControlFlowNode for __file__ |
|
||||
| main | __file__ | package/subpackage2/__init__.py:2:7:2:14 | ControlFlowNode for __file__ |
|
||||
| main | __file__ | package/subpackage2/__init__.py:6:6:6:13 | ControlFlowNode for __file__ |
|
||||
| main | _indent_level | trace.py:3:17:3:17 | ControlFlowNode for IntegerLiteral |
|
||||
@@ -130,6 +143,7 @@
|
||||
| main | print_function | main.py:21:24:21:37 | ControlFlowNode for ImportMember |
|
||||
| main | print_function | trace.py:1:24:1:37 | ControlFlowNode for ImportMember |
|
||||
| main | refined | main.py:97:8:97:14 | ControlFlowNode for ImportExpr |
|
||||
| main | simplistic_reexport | main.py:103:8:103:26 | ControlFlowNode for ImportExpr |
|
||||
| main | status | trace.py:23:1:23:13 | ControlFlowNode for FunctionExpr |
|
||||
| main | subpackage2_attr | package/subpackage2/__init__.py:4:20:4:37 | ControlFlowNode for Str |
|
||||
| main | subpackage_attr | main.py:46:6:46:23 | ControlFlowNode for ImportExpr |
|
||||
@@ -219,6 +233,25 @@
|
||||
| refined | print | trace.py:7:1:7:27 | ControlFlowNode for FunctionExpr |
|
||||
| refined | print_function | trace.py:1:24:1:37 | ControlFlowNode for ImportMember |
|
||||
| refined | status | trace.py:23:1:23:13 | ControlFlowNode for FunctionExpr |
|
||||
| simplistic_reexport | __all__ | trace.py:52:11:52:46 | ControlFlowNode for List |
|
||||
| simplistic_reexport | __file__ | baz.py:2:7:2:14 | ControlFlowNode for __file__ |
|
||||
| simplistic_reexport | __file__ | baz.py:6:6:6:13 | ControlFlowNode for __file__ |
|
||||
| simplistic_reexport | __file__ | simplistic_reexport.py:4:7:4:14 | ControlFlowNode for __file__ |
|
||||
| simplistic_reexport | __file__ | simplistic_reexport.py:19:6:19:13 | ControlFlowNode for __file__ |
|
||||
| simplistic_reexport | _indent_level | trace.py:3:17:3:17 | ControlFlowNode for IntegerLiteral |
|
||||
| simplistic_reexport | _print | trace.py:5:10:5:14 | ControlFlowNode for print |
|
||||
| simplistic_reexport | _status | trace.py:21:11:21:11 | ControlFlowNode for IntegerLiteral |
|
||||
| simplistic_reexport | bar_attr | simplistic_reexport.py:6:6:6:8 | ControlFlowNode for ImportExpr |
|
||||
| simplistic_reexport | bar_attr | simplistic_reexport.py:6:17:6:24 | ControlFlowNode for ImportMember |
|
||||
| simplistic_reexport | bar_attr | simplistic_reexport.py:9:12:9:24 | ControlFlowNode for Str |
|
||||
| simplistic_reexport | baz_attr | baz.py:4:12:4:21 | ControlFlowNode for Str |
|
||||
| simplistic_reexport | baz_attr | simplistic_reexport.py:16:12:16:24 | ControlFlowNode for Str |
|
||||
| simplistic_reexport | check | trace.py:26:1:26:61 | ControlFlowNode for FunctionExpr |
|
||||
| simplistic_reexport | enter | trace.py:11:1:11:21 | ControlFlowNode for FunctionExpr |
|
||||
| simplistic_reexport | exit | trace.py:16:1:16:20 | ControlFlowNode for FunctionExpr |
|
||||
| simplistic_reexport | print | trace.py:7:1:7:27 | ControlFlowNode for FunctionExpr |
|
||||
| simplistic_reexport | print_function | trace.py:1:24:1:37 | ControlFlowNode for ImportMember |
|
||||
| simplistic_reexport | status | trace.py:23:1:23:13 | ControlFlowNode for FunctionExpr |
|
||||
| trace | __all__ | trace.py:52:11:52:46 | ControlFlowNode for List |
|
||||
| trace | _indent_level | trace.py:3:17:3:17 | ControlFlowNode for IntegerLiteral |
|
||||
| trace | _print | trace.py:5:10:5:14 | ControlFlowNode for print |
|
||||
|
||||
6
python/ql/test/experimental/import-resolution/baz.py
Normal file
6
python/ql/test/experimental/import-resolution/baz.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from trace import *
|
||||
enter(__file__)
|
||||
|
||||
baz_attr = "baz_attr"
|
||||
|
||||
exit(__file__)
|
||||
@@ -100,6 +100,10 @@ check("refined.SOURCE", refined.SOURCE, refined.SOURCE, globals()) #$ prints=SOU
|
||||
import if_then_else_refined # $ imports=if_then_else_refined as=if_then_else_refined
|
||||
check("if_then_else_refined.src", if_then_else_refined.src, if_then_else_refined.src, globals()) #$ prints=SOURCE
|
||||
|
||||
import simplistic_reexport # $ imports=simplistic_reexport as=simplistic_reexport
|
||||
check("simplistic_reexport.bar_attr", simplistic_reexport.bar_attr, "overwritten", globals()) #$ prints=overwritten SPURIOUS: prints="<module bar>" prints=bar_attr
|
||||
check("simplistic_reexport.baz_attr", simplistic_reexport.baz_attr, "overwritten", globals()) #$ prints=overwritten SPURIOUS: prints=baz_attr
|
||||
|
||||
exit(__file__)
|
||||
|
||||
print()
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# we might consider anything imported to also be exported, but this is not the case
|
||||
|
||||
from trace import *
|
||||
enter(__file__)
|
||||
|
||||
from bar import bar_attr
|
||||
check("bar_attr", bar_attr, "bar_attr", globals()) #$ prints=bar_attr
|
||||
|
||||
bar_attr = "overwritten"
|
||||
check("bar_attr", bar_attr, "overwritten", globals()) #$ prints=overwritten
|
||||
|
||||
|
||||
from baz import *
|
||||
check("baz_attr", baz_attr, "baz_attr", globals()) #$ MISSING: prints=baz_attr
|
||||
|
||||
baz_attr = "overwritten"
|
||||
check("baz_attr", baz_attr, "overwritten", globals()) #$ prints=overwritten
|
||||
|
||||
exit(__file__)
|
||||
Reference in New Issue
Block a user