-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14114 from yoff/python/allow-namespace-packages
Python: Allow namespace packages
- Loading branch information
Showing
17 changed files
with
146 additions
and
40 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
python/ql/lib/change-notes/2023-09-29-allow-namespace-packages.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: minorAnalysis | ||
--- | ||
* Namespace packages in the form of regular packages with missing `__init__.py`-files are now allowed. This enables the analysis to resolve modules and functions inside such packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
python/ql/test/3/library-tests/modules/entry_point/modules.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
python/ql/test/experimental/library-tests/CallGraph-implicit-init/foo/bar/a.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
def afunc(): | ||
print("afunc called") | ||
return 1 | ||
print("afunc called") | ||
return 1 | ||
|
||
from foo.foo import foo_func | ||
foo_func() # $ pt,tt="foo/foo.py:foo_func" |
2 changes: 2 additions & 0 deletions
2
python/ql/test/experimental/library-tests/CallGraph-implicit-init/foo/foo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def foo_func(): | ||
print("foo_func called") |
7 changes: 5 additions & 2 deletions
7
python/ql/test/experimental/library-tests/CallGraph-implicit-init/foo_explicit/bar/a.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
def explicit_afunc(): | ||
print("explicit_afunc called") | ||
return 1 | ||
print("explicit_afunc called") | ||
return 1 | ||
|
||
from foo_explicit.foo_explicit import foo_explicit_func | ||
foo_explicit_func() # $ pt,tt="foo_explicit/foo_explicit.py:foo_explicit_func" |
2 changes: 2 additions & 0 deletions
2
...n/ql/test/experimental/library-tests/CallGraph-implicit-init/foo_explicit/foo_explicit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def foo_explicit_func(): | ||
print("foo_explicit_func called") |
6 changes: 6 additions & 0 deletions
6
python/ql/test/experimental/library-tests/CallGraph-implicit-init/not_root/baz/bar/a.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def afunc(): | ||
print("afunc called") | ||
return 1 | ||
|
||
from not_root.baz.foo import foo_func | ||
foo_func() # $ pt,tt="not_root/baz/foo.py:foo_func" |
2 changes: 2 additions & 0 deletions
2
python/ql/test/experimental/library-tests/CallGraph-implicit-init/not_root/baz/foo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def foo_func(): | ||
print("foo_func called") |
2 changes: 1 addition & 1 deletion
2
python/ql/test/experimental/library-tests/CallGraph-implicit-init/options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
semmle-extractor-options: --max-import-depth=1 --lang=3 | ||
semmle-extractor-options: --max-import-depth=3 --lang=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
| Local module | code-invalid-package-name/cmd.py:0:0:0:0 | Module cmd | referenced in external file called | pdb.py | | ||
| Local module | code-invalid-package-name/cmd.py:0:0:0:0 | Module cmd | referenced in local file called | test_ok.py | | ||
| Local module | code-invalid-package-name/unique_name.py:0:0:0:0 | Module unique_name | referenced in local file called | unique_name_use.py | |
4 changes: 2 additions & 2 deletions
4
...ary-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
| code-invalid-package-name/cmd.py:0:0:0:0 | Script cmd.py | | ||
| code-invalid-package-name/cmd.py:0:0:0:0 | Module cmd | | ||
| code-invalid-package-name/test_fail.py:0:0:0:0 | Script test_fail.py | | ||
| code-invalid-package-name/test_ok.py:0:0:0:0 | Script test_ok.py | | ||
| code-invalid-package-name/unique_name.py:0:0:0:0 | Script unique_name.py | | ||
| code-invalid-package-name/unique_name.py:0:0:0:0 | Module unique_name | | ||
| code-invalid-package-name/unique_name_use.py:0:0:0:0 | Script unique_name_use.py | |
4 changes: 2 additions & 2 deletions
4
...sts/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
| Module 'cmd' (external, in stdlib, not missing) referenced in local file | code-invalid-package-name/test_ok.py:1 | | ||
| Module 'cmd' (local, not in stdlib, not missing) referenced in local file | code-invalid-package-name/test_ok.py:1 | | ||
| Module 'pdb' (external, in stdlib, not missing) referenced in local file | code-invalid-package-name/test_fail.py:3 | | ||
| Module 'unique_name' (external, not in stdlib, missing) referenced in local file | code-invalid-package-name/unique_name_use.py:1 | | ||
| Module 'unique_name' (local, not in stdlib, not missing) referenced in local file | code-invalid-package-name/unique_name_use.py:1 | |