We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
__main__.py
1 parent e647403 commit ba6ab8fCopy full SHA for ba6ab8f
python/ql/src/semmle/python/Files.qll
@@ -92,6 +92,11 @@ class File extends Container {
92
) and
93
// Exclude files named `__main__.py`. These are often _not_ meant to be run directly, but
94
// contain this construct anyway.
95
+ //
96
+ // Their presence in a package (say, `foo`) means one can execute the package directly using
97
+ // `python -m foo` (which will run the `foo/__main__.py` file). Since being an entry point for
98
+ // execution means treating imports as absolute, this causes trouble, since when run with
99
+ // `python -m`, the interpreter uses the usual package semantics.
100
not this.getShortName() = "__main__.py"
101
or
102
// The file contains a `#!` line referencing the python interpreter
0 commit comments