diff --git a/python/extractor/cli-integration-test/extract-stdlib/test.sh b/python/extractor/cli-integration-test/extract-stdlib/test.sh index 6a61becd25c0..937cf08ce435 100755 --- a/python/extractor/cli-integration-test/extract-stdlib/test.sh +++ b/python/extractor/cli-integration-test/extract-stdlib/test.sh @@ -13,10 +13,10 @@ rm -rf dbs mkdir dbs -CODEQL_EXTRACTOR_PYTHON_DONT_EXTRACT_STDLIB=True $CODEQL database create dbs/without-stdlib --language python --source-root repo_dir/ +$CODEQL database create dbs/without-stdlib --language python --source-root repo_dir/ $CODEQL query run --database dbs/without-stdlib query.ql > query.without-stdlib.actual diff query.without-stdlib.expected query.without-stdlib.actual -LGTM_INDEX_EXCLUDE="/usr/lib/**" $CODEQL database create dbs/with-stdlib --language python --source-root repo_dir/ +LGTM_INDEX_EXCLUDE="/usr/lib/**" CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB=True $CODEQL database create dbs/with-stdlib --language python --source-root repo_dir/ $CODEQL query run --database dbs/with-stdlib query.ql > query.with-stdlib.actual diff query.with-stdlib.expected query.with-stdlib.actual diff --git a/python/extractor/semmle/cmdline.py b/python/extractor/semmle/cmdline.py index 9c2ff4a32744..47007c065fdc 100644 --- a/python/extractor/semmle/cmdline.py +++ b/python/extractor/semmle/cmdline.py @@ -102,8 +102,10 @@ def make_parser(): config_options.add_option("--colorize", dest="colorize", default=False, action="store_true", help = """Colorize the logging output.""") - config_options.add_option("--dont-extract-stdlib", dest="extract_stdlib", default=True, action="store_false", - help="Do not extract the standard library.") + config_options.add_option("--dont-extract-stdlib", dest="extract_stdlib", action="store_false", + help="This flag is deprecated; not extracting the standard library is now the default.") + config_options.add_option("--extract-stdlib", dest="extract_stdlib", default=False, action="store_true", + help="Extract the standard library.") parser.add_option_group(config_options) @@ -226,8 +228,18 @@ def parse(command_line): if 'CODEQL_EXTRACTOR_PYTHON_DONT_EXTRACT_STDLIB' in os.environ: options.extract_stdlib = False + print ("WARNING: CODEQL_EXTRACTOR_PYTHON_DONT_EXTRACT_STDLIB is deprecated; the default is now to not extract the standard library.") + + if 'CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB' in os.environ: + options.extract_stdlib = True options.prune = True + + if options.extract_stdlib: + print ("WARNING: The analysis will extract the standard library. This behavior is deprecated and will be removed in a future release. We expect it to be gone in CLI version 2.20.0.") + else: + print ("INFO: The Python extractor has recently stopped extracting the standard library by default. If you encounter problems, please let us know by submitting an issue to https://github.com/github/codeql. It is possible to re-enable extraction of the standard library by setting the environment variable CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB.") + return options, args def split_and_flatten(options_list, div): diff --git a/python/extractor/semmle/populator.py b/python/extractor/semmle/populator.py index c2d6b6277c90..a1be196ffaf6 100644 --- a/python/extractor/semmle/populator.py +++ b/python/extractor/semmle/populator.py @@ -67,7 +67,7 @@ def main(sys_path = sys.path[:]): update_analysis_version(last_version) found_py2 = False - if get_analysis_major_version() == 2: + if get_analysis_major_version() == 2 and options.extract_stdlib: # Setup `sys_path` to use the Python 2 standard library sys_path, found_py2 = get_py2_sys_path(logger, sys_path) diff --git a/python/extractor/semmle/util.py b/python/extractor/semmle/util.py index 8e1a371fc717..41af1d497b32 100644 --- a/python/extractor/semmle/util.py +++ b/python/extractor/semmle/util.py @@ -10,7 +10,7 @@ #Semantic version of extractor. #Update this if any changes are made -VERSION = "6.1.2" +VERSION = "7.0.0" PY_EXTENSIONS = ".py", ".pyw" diff --git a/python/ql/test/2/library-tests/PointsTo/class_properties/ClassValues.expected b/python/ql/test/2/library-tests/PointsTo/class_properties/ClassValues.expected index 9835b2573b19..56d3bde865f4 100644 --- a/python/ql/test/2/library-tests/PointsTo/class_properties/ClassValues.expected +++ b/python/ql/test/2/library-tests/PointsTo/class_properties/ClassValues.expected @@ -1,12 +1,10 @@ -| mapping | builtin-class collections.defaultdict | | mapping | builtin-class dict | | mapping | class MyDictSubclass | -| mapping | class MyMappingABC | -| mapping | class OrderedDict | | neither sequence nor mapping | builtin-class set | +| neither sequence nor mapping | class MyMappingABC | +| neither sequence nor mapping | class MySequenceABC | | sequence | builtin-class list | | sequence | builtin-class str | | sequence | builtin-class tuple | | sequence | builtin-class unicode | -| sequence | class MySequenceABC | | sequence | class MySequenceImpl | diff --git a/python/ql/test/2/library-tests/PointsTo/imports2/Runtime.expected b/python/ql/test/2/library-tests/PointsTo/imports2/Runtime.expected index 345f112dccb9..fe825523ca21 100644 --- a/python/ql/test/2/library-tests/PointsTo/imports2/Runtime.expected +++ b/python/ql/test/2/library-tests/PointsTo/imports2/Runtime.expected @@ -44,14 +44,10 @@ | test.py | 15 | ControlFlowNode for moduleX | Module package.moduleX | Entry node for Module package.moduleX | | test.py | 16 | ControlFlowNode for Attribute | class Y | ControlFlowNode for ClassExpr | | test.py | 16 | ControlFlowNode for moduleX | Module package.moduleX | Entry node for Module package.moduleX | -| test.py | 19 | ControlFlowNode for ImportExpr | Module tty | ControlFlowNode for ImportExpr | -| test.py | 19 | ControlFlowNode for tty | Module tty | ControlFlowNode for ImportExpr | | test.py | 22 | ControlFlowNode for Attribute | Builtin-function exc_info | ControlFlowNode for from sys import * | | test.py | 22 | ControlFlowNode for x | Module package.x | Entry node for Module package.x | | test.py | 24 | ControlFlowNode for IntegerLiteral | int 0 | ControlFlowNode for IntegerLiteral | | test.py | 24 | ControlFlowNode for argv | int 0 | ControlFlowNode for IntegerLiteral | | test.py | 27 | ControlFlowNode for ImportExpr | Module sys | ControlFlowNode for ImportExpr | | test.py | 31 | ControlFlowNode for argv | list object | ControlFlowNode for from sys import * | -| test.py | 33 | ControlFlowNode for ImportExpr | Module socket | ControlFlowNode for ImportExpr | -| test.py | 34 | ControlFlowNode for timeout | builtin-class socket.timeout | ControlFlowNode for from _socket import * | | x.py | 2 | ControlFlowNode for ImportExpr | Module sys | ControlFlowNode for ImportExpr | diff --git a/python/ql/test/2/library-tests/PointsTo/imports2/RuntimeWithType.expected b/python/ql/test/2/library-tests/PointsTo/imports2/RuntimeWithType.expected index 7082c15e4104..e55d70d073df 100644 --- a/python/ql/test/2/library-tests/PointsTo/imports2/RuntimeWithType.expected +++ b/python/ql/test/2/library-tests/PointsTo/imports2/RuntimeWithType.expected @@ -44,14 +44,10 @@ | test.py | 15 | ControlFlowNode for moduleX | Module package.moduleX | builtin-class module | Entry node for Module package.moduleX | | test.py | 16 | ControlFlowNode for Attribute | class Y | builtin-class type | ControlFlowNode for ClassExpr | | test.py | 16 | ControlFlowNode for moduleX | Module package.moduleX | builtin-class module | Entry node for Module package.moduleX | -| test.py | 19 | ControlFlowNode for ImportExpr | Module tty | builtin-class module | ControlFlowNode for ImportExpr | -| test.py | 19 | ControlFlowNode for tty | Module tty | builtin-class module | ControlFlowNode for ImportExpr | | test.py | 22 | ControlFlowNode for Attribute | Builtin-function exc_info | builtin-class builtin_function_or_method | ControlFlowNode for from sys import * | | test.py | 22 | ControlFlowNode for x | Module package.x | builtin-class module | Entry node for Module package.x | | test.py | 24 | ControlFlowNode for IntegerLiteral | int 0 | builtin-class int | ControlFlowNode for IntegerLiteral | | test.py | 24 | ControlFlowNode for argv | int 0 | builtin-class int | ControlFlowNode for IntegerLiteral | | test.py | 27 | ControlFlowNode for ImportExpr | Module sys | builtin-class module | ControlFlowNode for ImportExpr | | test.py | 31 | ControlFlowNode for argv | list object | builtin-class list | ControlFlowNode for from sys import * | -| test.py | 33 | ControlFlowNode for ImportExpr | Module socket | builtin-class module | ControlFlowNode for ImportExpr | -| test.py | 34 | ControlFlowNode for timeout | builtin-class socket.timeout | builtin-class type | ControlFlowNode for from _socket import * | | x.py | 2 | ControlFlowNode for ImportExpr | Module sys | builtin-class module | ControlFlowNode for ImportExpr | diff --git a/python/ql/test/2/library-tests/six/pointsto.expected b/python/ql/test/2/library-tests/six/pointsto.expected index ca063a000e31..1d2e4e7f74e2 100644 --- a/python/ql/test/2/library-tests/six/pointsto.expected +++ b/python/ql/test/2/library-tests/six/pointsto.expected @@ -1,7 +1,7 @@ | six | Package six | | six.moves | Package six.moves | -| six.moves.http_client | Module httplib | -| six.moves.http_client.HTTPConnection | class HTTPConnection | +| six.moves.http_client | Missing module httplib | +| six.moves.http_client.HTTPConnection | Missing module attribute httplib.HTTPConnection | | six.moves.range | builtin-class xrange | | six.moves.urllib | Package six.moves.urllib | | six.moves.urllib.parse | Module six.moves.urllib_parse | diff --git a/python/ql/test/2/query-tests/Summary/LinesOfCode.expected b/python/ql/test/2/query-tests/Summary/LinesOfCode.expected index 5aa95ec1ce55..74c7709367a7 100644 --- a/python/ql/test/2/query-tests/Summary/LinesOfCode.expected +++ b/python/ql/test/2/query-tests/Summary/LinesOfCode.expected @@ -1 +1 @@ -| 38 | +| 11 | diff --git a/python/ql/test/3/library-tests/PointsTo/class_properties/ClassValues.expected b/python/ql/test/3/library-tests/PointsTo/class_properties/ClassValues.expected index 537882af86f7..2c6a15909646 100644 --- a/python/ql/test/3/library-tests/PointsTo/class_properties/ClassValues.expected +++ b/python/ql/test/3/library-tests/PointsTo/class_properties/ClassValues.expected @@ -1,9 +1,6 @@ -| mapping | builtin-class collections.OrderedDict | -| mapping | builtin-class collections.defaultdict | | mapping | builtin-class dict | | mapping | class MyDictSubclass | | mapping | class MyMappingABC | -| mapping | class OrderedDict | | neither sequence nor mapping | builtin-class set | | sequence | builtin-class bytes | | sequence | builtin-class list | diff --git a/python/ql/test/3/library-tests/PointsTo/imports/Runtime.expected b/python/ql/test/3/library-tests/PointsTo/imports/Runtime.expected index f1dcc270a3ed..fe825523ca21 100644 --- a/python/ql/test/3/library-tests/PointsTo/imports/Runtime.expected +++ b/python/ql/test/3/library-tests/PointsTo/imports/Runtime.expected @@ -44,14 +44,10 @@ | test.py | 15 | ControlFlowNode for moduleX | Module package.moduleX | Entry node for Module package.moduleX | | test.py | 16 | ControlFlowNode for Attribute | class Y | ControlFlowNode for ClassExpr | | test.py | 16 | ControlFlowNode for moduleX | Module package.moduleX | Entry node for Module package.moduleX | -| test.py | 19 | ControlFlowNode for ImportExpr | Module tty | ControlFlowNode for ImportExpr | -| test.py | 19 | ControlFlowNode for tty | Module tty | ControlFlowNode for ImportExpr | | test.py | 22 | ControlFlowNode for Attribute | Builtin-function exc_info | ControlFlowNode for from sys import * | | test.py | 22 | ControlFlowNode for x | Module package.x | Entry node for Module package.x | | test.py | 24 | ControlFlowNode for IntegerLiteral | int 0 | ControlFlowNode for IntegerLiteral | | test.py | 24 | ControlFlowNode for argv | int 0 | ControlFlowNode for IntegerLiteral | | test.py | 27 | ControlFlowNode for ImportExpr | Module sys | ControlFlowNode for ImportExpr | | test.py | 31 | ControlFlowNode for argv | list object | ControlFlowNode for from sys import * | -| test.py | 33 | ControlFlowNode for ImportExpr | Module socket | ControlFlowNode for ImportExpr | -| test.py | 34 | ControlFlowNode for timeout | builtin-class TimeoutError | ControlFlowNode for from _socket import * | | x.py | 2 | ControlFlowNode for ImportExpr | Module sys | ControlFlowNode for ImportExpr | diff --git a/python/ql/test/3/library-tests/PointsTo/imports/RuntimeWithType.expected b/python/ql/test/3/library-tests/PointsTo/imports/RuntimeWithType.expected index 60cc3c6b52db..e55d70d073df 100644 --- a/python/ql/test/3/library-tests/PointsTo/imports/RuntimeWithType.expected +++ b/python/ql/test/3/library-tests/PointsTo/imports/RuntimeWithType.expected @@ -44,14 +44,10 @@ | test.py | 15 | ControlFlowNode for moduleX | Module package.moduleX | builtin-class module | Entry node for Module package.moduleX | | test.py | 16 | ControlFlowNode for Attribute | class Y | builtin-class type | ControlFlowNode for ClassExpr | | test.py | 16 | ControlFlowNode for moduleX | Module package.moduleX | builtin-class module | Entry node for Module package.moduleX | -| test.py | 19 | ControlFlowNode for ImportExpr | Module tty | builtin-class module | ControlFlowNode for ImportExpr | -| test.py | 19 | ControlFlowNode for tty | Module tty | builtin-class module | ControlFlowNode for ImportExpr | | test.py | 22 | ControlFlowNode for Attribute | Builtin-function exc_info | builtin-class builtin_function_or_method | ControlFlowNode for from sys import * | | test.py | 22 | ControlFlowNode for x | Module package.x | builtin-class module | Entry node for Module package.x | | test.py | 24 | ControlFlowNode for IntegerLiteral | int 0 | builtin-class int | ControlFlowNode for IntegerLiteral | | test.py | 24 | ControlFlowNode for argv | int 0 | builtin-class int | ControlFlowNode for IntegerLiteral | | test.py | 27 | ControlFlowNode for ImportExpr | Module sys | builtin-class module | ControlFlowNode for ImportExpr | | test.py | 31 | ControlFlowNode for argv | list object | builtin-class list | ControlFlowNode for from sys import * | -| test.py | 33 | ControlFlowNode for ImportExpr | Module socket | builtin-class module | ControlFlowNode for ImportExpr | -| test.py | 34 | ControlFlowNode for timeout | builtin-class TimeoutError | builtin-class type | ControlFlowNode for from _socket import * | | x.py | 2 | ControlFlowNode for ImportExpr | Module sys | builtin-class module | ControlFlowNode for ImportExpr | diff --git a/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.expected b/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.expected index 1c02b5ee6c6e..ef899d04d790 100644 --- a/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.expected +++ b/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.expected @@ -1,3 +1,3 @@ -| mwe_failure.py:7:1:7:23 | class MyTest | | -| mwe_failure_2.py:7:1:7:23 | class MyTest | | +| mwe_failure.py:7:1:7:23 | class MyTest | class TestCase | +| mwe_failure_2.py:7:1:7:23 | class MyTest | class TestCase | | mwe_success.py:7:1:7:23 | class MyTest | class TestCase | diff --git a/python/ql/test/3/library-tests/modules/general/moduleobject_test.expected b/python/ql/test/3/library-tests/modules/general/moduleobject_test.expected index eed40d8d9329..53f645c9a9ee 100644 --- a/python/ql/test/3/library-tests/modules/general/moduleobject_test.expected +++ b/python/ql/test/3/library-tests/modules/general/moduleobject_test.expected @@ -37,7 +37,6 @@ | Module package.assistant | e | Wrong() | | Module package.assistant | f | int 1 | | Module package.helper | __name__ | str u'package.helper' | -| Module package.helper | absolute_import | _Feature() | | Module package.helper | assistant | Module package.assistant | | Module package.helper | d | int 4 | | Module package.helper | e | int 5 | diff --git a/python/ql/test/3/library-tests/six/pointsto.expected b/python/ql/test/3/library-tests/six/pointsto.expected index 83f61848b7cd..85a50cad8085 100644 --- a/python/ql/test/3/library-tests/six/pointsto.expected +++ b/python/ql/test/3/library-tests/six/pointsto.expected @@ -1,7 +1,7 @@ | six | Package six | | six.moves | Package six.moves | -| six.moves.http_client | Module http.client | -| six.moves.http_client.HTTPConnection | class HTTPConnection | +| six.moves.http_client | Missing module http.client | +| six.moves.http_client.HTTPConnection | Missing module attribute http.client.HTTPConnection | | six.moves.range | builtin-class range | | six.moves.urllib | Package six.moves.urllib | | six.moves.urllib.parse | Module six.moves.urllib_parse | diff --git a/python/ql/test/3/query-tests/Summary/LinesOfCode.expected b/python/ql/test/3/query-tests/Summary/LinesOfCode.expected index 183d68cab22a..74c7709367a7 100644 --- a/python/ql/test/3/query-tests/Summary/LinesOfCode.expected +++ b/python/ql/test/3/query-tests/Summary/LinesOfCode.expected @@ -1 +1 @@ -| 51 | +| 11 | diff --git a/python/ql/test/3/query-tests/Variables/undefined/UndefinedExport.expected b/python/ql/test/3/query-tests/Variables/undefined/UndefinedExport.expected index 2b1ef223673e..6bd8188ed3de 100644 --- a/python/ql/test/3/query-tests/Variables/undefined/UndefinedExport.expected +++ b/python/ql/test/3/query-tests/Variables/undefined/UndefinedExport.expected @@ -1,4 +1,6 @@ | UndefinedExport.py:3:18:3:20 | StringLiteral | The name 'y' is exported by __all__ but is not defined. | | UndefinedExport.py:3:23:3:25 | StringLiteral | The name 'z' is exported by __all__ but is not defined. | | UndefinedExport.py:3:28:3:35 | StringLiteral | The name 'module' is exported by __all__ but is not defined. | +| enum_convert.py:8:13:8:19 | StringLiteral | The name 'Maybe' is exported by __all__ but is not defined. | +| enum_convert.py:8:22:8:32 | StringLiteral | The name 'Maybe_not' is exported by __all__ but is not defined. | | package/__init__.py:1:23:1:34 | StringLiteral | The name 'not_exists' is exported by __all__ but is not defined. | diff --git a/python/ql/test/extractor-tests/flags/Flags.expected b/python/ql/test/extractor-tests/flags/Flags.expected index 380cf9a08241..eeb4db916e73 100644 --- a/python/ql/test/extractor-tests/flags/Flags.expected +++ b/python/ql/test/extractor-tests/flags/Flags.expected @@ -1,7 +1,7 @@ | options.all | False | | options.colorize | True | | options.context_cost | 11 | -| options.extract_stdlib | True | +| options.extract_stdlib | False | | options.guess | False | | options.help | False | | options.ignore_missing_modules | False | diff --git a/python/ql/test/library-tests/PointsTo/decorators/Test.expected b/python/ql/test/library-tests/PointsTo/decorators/Test.expected index 4352b429ca01..4e465134ef63 100644 --- a/python/ql/test/library-tests/PointsTo/decorators/Test.expected +++ b/python/ql/test/library-tests/PointsTo/decorators/Test.expected @@ -1,4 +1,3 @@ -| 1 | ControlFlowNode for functools | Module functools | test.py:1 | | 3 | ControlFlowNode for annotate | Function annotate | test.py:3 | | 4 | ControlFlowNode for inner | Function inner | test.py:4 | | 5 | ControlFlowNode for func | Function func1 | test.py:23 | @@ -11,7 +10,6 @@ | 13 | ControlFlowNode for wrapper | Function wrapper | test.py:10 | | 15 | ControlFlowNode for wraps2 | Function wraps2 | test.py:15 | | 16 | ControlFlowNode for func | Function func3 | test.py:31 | -| 16 | ControlFlowNode for functools | Module functools | test.py:1 | | 17 | ControlFlowNode for args | args | test.py:17 | | 17 | ControlFlowNode for wrapper | Attribute()() | test.py:16 | | 18 | ControlFlowNode for args | args | test.py:17 | diff --git a/python/ql/test/library-tests/PointsTo/decorators/Values.expected b/python/ql/test/library-tests/PointsTo/decorators/Values.expected index d9887d944f16..c63ec2d22ccd 100644 --- a/python/ql/test/library-tests/PointsTo/decorators/Values.expected +++ b/python/ql/test/library-tests/PointsTo/decorators/Values.expected @@ -7,8 +7,8 @@ | test.py:11:21:11:24 | ControlFlowNode for args | runtime | instance of tuple | | test.py:13:12:13:18 | ControlFlowNode for wrapper | runtime | Function wraps1.wrapper | | test.py:13:12:13:18 | ControlFlowNode for wrapper | test.py:26 from import | Function wraps1.wrapper | -| test.py:16:6:16:14 | ControlFlowNode for functools | runtime | Module functools | -| test.py:16:6:16:14 | ControlFlowNode for functools | test.py:30 from import | Module functools | +| test.py:16:6:16:14 | ControlFlowNode for functools | runtime | Missing module functools | +| test.py:16:6:16:14 | ControlFlowNode for functools | test.py:30 from import | Missing module functools | | test.py:16:22:16:25 | ControlFlowNode for func | runtime | Unknown value | | test.py:16:22:16:25 | ControlFlowNode for func | test.py:30 from import | Function func3 | | test.py:18:21:18:24 | ControlFlowNode for args | runtime | instance of tuple | diff --git a/python/ql/test/library-tests/PointsTo/general/GlobalPointsTo.expected b/python/ql/test/library-tests/PointsTo/general/GlobalPointsTo.expected index 9040788529a8..85c8304b58aa 100644 --- a/python/ql/test/library-tests/PointsTo/general/GlobalPointsTo.expected +++ b/python/ql/test/library-tests/PointsTo/general/GlobalPointsTo.expected @@ -87,10 +87,6 @@ | Module pointsto_test | 69 | ControlFlowNode for X | class X | | Module pointsto_test | 70 | ControlFlowNode for Attribute | deco() | | Module pointsto_test | 70 | ControlFlowNode for X | class X | -| Module pointsto_test | 72 | ControlFlowNode for ImportExpr | Module abc | -| Module pointsto_test | 72 | ControlFlowNode for ImportMember | Function abstractmethod | -| Module pointsto_test | 72 | ControlFlowNode for abstractmethod | Function abstractmethod | -| Module pointsto_test | 73 | ControlFlowNode for abstractmethod | Function abstractmethod | | Module pointsto_test | 75 | ControlFlowNode for C | class C | | Module pointsto_test | 75 | ControlFlowNode for C() | C() | | Module pointsto_test | 75 | ControlFlowNode for type | builtin-class type | diff --git a/python/ql/test/library-tests/PointsTo/general/LocalPointsTo.expected b/python/ql/test/library-tests/PointsTo/general/LocalPointsTo.expected index b94942506153..fc4970a8c0cc 100644 --- a/python/ql/test/library-tests/PointsTo/general/LocalPointsTo.expected +++ b/python/ql/test/library-tests/PointsTo/general/LocalPointsTo.expected @@ -95,10 +95,6 @@ | 69 | ControlFlowNode for X | class X | | 70 | ControlFlowNode for Attribute | deco() | | 70 | ControlFlowNode for X | class X | -| 72 | ControlFlowNode for ImportExpr | Module abc | -| 72 | ControlFlowNode for ImportMember | Function abstractmethod | -| 72 | ControlFlowNode for abstractmethod | Function abstractmethod | -| 73 | ControlFlowNode for abstractmethod | Function abstractmethod | | 75 | ControlFlowNode for C | class C | | 75 | ControlFlowNode for C() | C() | | 75 | ControlFlowNode for type | builtin-class type | diff --git a/python/ql/test/library-tests/PointsTo/general/LocalPointsToType.expected b/python/ql/test/library-tests/PointsTo/general/LocalPointsToType.expected index 15f283ac4b97..92dde139cdec 100644 --- a/python/ql/test/library-tests/PointsTo/general/LocalPointsToType.expected +++ b/python/ql/test/library-tests/PointsTo/general/LocalPointsToType.expected @@ -95,10 +95,6 @@ | 69 | ControlFlowNode for Attribute | Attribute | builtin-class method | | 69 | ControlFlowNode for X | class X | builtin-class type | | 70 | ControlFlowNode for X | class X | builtin-class type | -| 72 | ControlFlowNode for ImportExpr | Module abc | builtin-class module | -| 72 | ControlFlowNode for ImportMember | Function abstractmethod | builtin-class function | -| 72 | ControlFlowNode for abstractmethod | Function abstractmethod | builtin-class function | -| 73 | ControlFlowNode for abstractmethod | Function abstractmethod | builtin-class function | | 75 | ControlFlowNode for C | class C | builtin-class type | | 75 | ControlFlowNode for C() | C() | class C | | 75 | ControlFlowNode for type | builtin-class type | builtin-class type | diff --git a/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected b/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected index b6872c3a4e62..8c83b21f782c 100644 --- a/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected +++ b/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected @@ -70,7 +70,3 @@ | type_test.py | 55 | ControlFlowNode for arg | class E | 29 | | type_test.py | 67 | ControlFlowNode for x | float 1.0 | 62 | | type_test.py | 67 | ControlFlowNode for x | int 0 | 62 | -| type_test.py | 77 | ControlFlowNode for IntegerLiteral | int 0 | 77 | -| type_test.py | 83 | ControlFlowNode for IntegerLiteral | int 0 | 83 | -| type_test.py | 89 | ControlFlowNode for IntegerLiteral | int 0 | 89 | -| type_test.py | 95 | ControlFlowNode for IntegerLiteral | int 0 | 95 | diff --git a/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected b/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected index 2f71fc6107b6..9993b96d18a6 100644 --- a/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected +++ b/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected @@ -70,7 +70,3 @@ | type_test.py | 55 | ControlFlowNode for arg | class E | builtin-class type | 29 | | type_test.py | 67 | ControlFlowNode for x | float 1.0 | builtin-class float | 62 | | type_test.py | 67 | ControlFlowNode for x | int 0 | builtin-class int | 62 | -| type_test.py | 77 | ControlFlowNode for IntegerLiteral | int 0 | builtin-class int | 77 | -| type_test.py | 83 | ControlFlowNode for IntegerLiteral | int 0 | builtin-class int | 83 | -| type_test.py | 89 | ControlFlowNode for IntegerLiteral | int 0 | builtin-class int | 89 | -| type_test.py | 95 | ControlFlowNode for IntegerLiteral | int 0 | builtin-class int | 95 | diff --git a/python/ql/test/library-tests/PointsTo/new/NameSpace.expected b/python/ql/test/library-tests/PointsTo/new/NameSpace.expected index 6508ef5b13f3..43f4158ba7fa 100644 --- a/python/ql/test/library-tests/PointsTo/new/NameSpace.expected +++ b/python/ql/test/library-tests/PointsTo/new/NameSpace.expected @@ -85,15 +85,12 @@ | h_classes.py:23 | Class Base | __init__ | Function __init__ | | h_classes.py:48 | Class D | m | Function f | | h_classes.py:48 | Class D | n | Function n | -| i_imports.py:0 | Module code.i_imports | BytesIO | builtin-class _io.BytesIO | -| i_imports.py:0 | Module code.i_imports | StringIO | builtin-class _io.StringIO | | i_imports.py:0 | Module code.i_imports | _io | Module _io | | i_imports.py:0 | Module code.i_imports | a | int 1 | | i_imports.py:0 | Module code.i_imports | argv | list object | | i_imports.py:0 | Module code.i_imports | b | int 2 | | i_imports.py:0 | Module code.i_imports | c | int 3 | | i_imports.py:0 | Module code.i_imports | code | Module code | -| i_imports.py:0 | Module code.i_imports | io | Module io | | i_imports.py:0 | Module code.i_imports | module1 | Module code.test_package.module1 | | i_imports.py:0 | Module code.i_imports | module2 | Module code.test_package.module2 | | i_imports.py:0 | Module code.i_imports | p | int 1 | diff --git a/python/ql/test/library-tests/PointsTo/new/PointsToWithContext.expected b/python/ql/test/library-tests/PointsTo/new/PointsToWithContext.expected index cd1a08a4dac2..04c794f49adf 100644 --- a/python/ql/test/library-tests/PointsTo/new/PointsToWithContext.expected +++ b/python/ql/test/library-tests/PointsTo/new/PointsToWithContext.expected @@ -475,14 +475,6 @@ | i_imports.py:31 | ControlFlowNode for Attribute | builtin-class _io.BytesIO | builtin-class type | 31 | import | | i_imports.py:31 | ControlFlowNode for BytesIO | builtin-class _io.BytesIO | builtin-class type | 31 | import | | i_imports.py:31 | ControlFlowNode for _io | Module _io | builtin-class module | 29 | import | -| i_imports.py:33 | ControlFlowNode for ImportExpr | Module io | builtin-class module | 33 | import | -| i_imports.py:33 | ControlFlowNode for io | Module io | builtin-class module | 33 | import | -| i_imports.py:34 | ControlFlowNode for Attribute | builtin-class _io.StringIO | builtin-class type | 55 | import | -| i_imports.py:34 | ControlFlowNode for StringIO | builtin-class _io.StringIO | builtin-class type | 55 | import | -| i_imports.py:34 | ControlFlowNode for io | Module io | builtin-class module | 33 | import | -| i_imports.py:35 | ControlFlowNode for Attribute | builtin-class _io.BytesIO | builtin-class type | 55 | import | -| i_imports.py:35 | ControlFlowNode for BytesIO | builtin-class _io.BytesIO | builtin-class type | 55 | import | -| i_imports.py:35 | ControlFlowNode for io | Module io | builtin-class module | 33 | import | | i_imports.py:37 | ControlFlowNode for ImportExpr | Module code | builtin-class module | 37 | import | | i_imports.py:37 | ControlFlowNode for code | Module code | builtin-class module | 37 | import | | i_imports.py:38 | ControlFlowNode for Attribute | Function f2 | builtin-class function | 24 | import | diff --git a/python/ql/test/library-tests/PointsTo/new/PointsToWithType.expected b/python/ql/test/library-tests/PointsTo/new/PointsToWithType.expected index 783237edc9d3..15e9081dd206 100644 --- a/python/ql/test/library-tests/PointsTo/new/PointsToWithType.expected +++ b/python/ql/test/library-tests/PointsTo/new/PointsToWithType.expected @@ -572,14 +572,6 @@ | i_imports.py:31 | ControlFlowNode for Attribute | builtin-class _io.BytesIO | builtin-class type | 31 | | i_imports.py:31 | ControlFlowNode for BytesIO | builtin-class _io.BytesIO | builtin-class type | 31 | | i_imports.py:31 | ControlFlowNode for _io | Module _io | builtin-class module | 29 | -| i_imports.py:33 | ControlFlowNode for ImportExpr | Module io | builtin-class module | 33 | -| i_imports.py:33 | ControlFlowNode for io | Module io | builtin-class module | 33 | -| i_imports.py:34 | ControlFlowNode for Attribute | builtin-class _io.StringIO | builtin-class type | 55 | -| i_imports.py:34 | ControlFlowNode for StringIO | builtin-class _io.StringIO | builtin-class type | 55 | -| i_imports.py:34 | ControlFlowNode for io | Module io | builtin-class module | 33 | -| i_imports.py:35 | ControlFlowNode for Attribute | builtin-class _io.BytesIO | builtin-class type | 55 | -| i_imports.py:35 | ControlFlowNode for BytesIO | builtin-class _io.BytesIO | builtin-class type | 55 | -| i_imports.py:35 | ControlFlowNode for io | Module io | builtin-class module | 33 | | i_imports.py:37 | ControlFlowNode for ImportExpr | Module code | builtin-class module | 37 | | i_imports.py:37 | ControlFlowNode for code | Module code | builtin-class module | 37 | | i_imports.py:38 | ControlFlowNode for Attribute | Function f2 | builtin-class function | 24 | diff --git a/python/ql/test/library-tests/PointsTo/new/Values.expected b/python/ql/test/library-tests/PointsTo/new/Values.expected index 5466ca854457..396249f9b94e 100644 --- a/python/ql/test/library-tests/PointsTo/new/Values.expected +++ b/python/ql/test/library-tests/PointsTo/new/Values.expected @@ -373,11 +373,9 @@ | i_imports.py:30 | ControlFlowNode for _io | import | Module _io | builtin-class module | | i_imports.py:31 | ControlFlowNode for Attribute | import | builtin-class _io.BytesIO | builtin-class type | | i_imports.py:31 | ControlFlowNode for _io | import | Module _io | builtin-class module | -| i_imports.py:33 | ControlFlowNode for ImportExpr | import | Module io | builtin-class module | -| i_imports.py:34 | ControlFlowNode for Attribute | import | builtin-class _io.StringIO | builtin-class type | -| i_imports.py:34 | ControlFlowNode for io | import | Module io | builtin-class module | -| i_imports.py:35 | ControlFlowNode for Attribute | import | builtin-class _io.BytesIO | builtin-class type | -| i_imports.py:35 | ControlFlowNode for io | import | Module io | builtin-class module | +| i_imports.py:33 | ControlFlowNode for ImportExpr | import | Missing module io | builtin-class module | +| i_imports.py:34 | ControlFlowNode for io | import | Missing module io | builtin-class module | +| i_imports.py:35 | ControlFlowNode for io | import | Missing module io | builtin-class module | | i_imports.py:37 | ControlFlowNode for ImportExpr | import | Package code | builtin-class module | | i_imports.py:38 | ControlFlowNode for Attribute | import | Function f2 | builtin-class function | | i_imports.py:38 | ControlFlowNode for Attribute | import | Module code.n_nesting | builtin-class module | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected index 92e569f09e6e..f79649b8a1a8 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected @@ -1,3 +1,2 @@ -| 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 | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected index cf5d7560b9ae..4c08caeec0bc 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected @@ -1,3 +1,3 @@ | 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 'pdb' (external, not in stdlib, missing) referenced in local file | code-invalid-package-name/test_fail.py:3 | | Module 'unique_name' (local, not in stdlib, not missing) referenced in local file | code-invalid-package-name/unique_name_use.py:1 | diff --git a/python/ql/test/library-tests/dataflow/coverage-py3/argumentRoutingTest.expected b/python/ql/test/library-tests/dataflow/coverage-py3/argumentRoutingTest.expected index 8ec8033d086e..8f2ca113e3c3 100644 --- a/python/ql/test/library-tests/dataflow/coverage-py3/argumentRoutingTest.expected +++ b/python/ql/test/library-tests/dataflow/coverage-py3/argumentRoutingTest.expected @@ -1,2 +1,6 @@ testFailures +| classes.py:54:44:54:107 | Comment #$ arg1="with_length_hint" func=With_length_hint.__length_hint__ | Missing result:arg1="with_length_hint" | +| classes.py:54:44:54:107 | Comment #$ arg1="with_length_hint" func=With_length_hint.__length_hint__ | Missing result:func=With_length_hint.__length_hint__ | +| classes.py:71:32:71:77 | Comment #$ arg1="with_index" func=With_index.__index__ | Missing result:arg1="with_index" | +| classes.py:71:32:71:77 | Comment #$ arg1="with_index" func=With_index.__index__ | Missing result:func=With_index.__index__ | failures diff --git a/python/ql/test/library-tests/dataflow/fieldflow/UnresolvedCalls.expected b/python/ql/test/library-tests/dataflow/fieldflow/UnresolvedCalls.expected index 8ec8033d086e..961827020749 100644 --- a/python/ql/test/library-tests/dataflow/fieldflow/UnresolvedCalls.expected +++ b/python/ql/test/library-tests/dataflow/fieldflow/UnresolvedCalls.expected @@ -1,2 +1,6 @@ testFailures +| test.py:4:17:4:60 | ControlFlowNode for Attribute() | Unexpected result: unresolved_call=os.path.dirname(..) | +| test.py:4:33:4:59 | ControlFlowNode for Attribute() | Unexpected result: unresolved_call=os.path.dirname(..) | +| test_dict.py:4:17:4:60 | ControlFlowNode for Attribute() | Unexpected result: unresolved_call=os.path.dirname(..) | +| test_dict.py:4:33:4:59 | ControlFlowNode for Attribute() | Unexpected result: unresolved_call=os.path.dirname(..) | failures diff --git a/python/ql/test/library-tests/frameworks/stdlib/threat_models.py b/python/ql/test/library-tests/frameworks/stdlib/threat_models.py index 23b800ce576e..4b6a1a066e7f 100644 --- a/python/ql/test/library-tests/frameworks/stdlib/threat_models.py +++ b/python/ql/test/library-tests/frameworks/stdlib/threat_models.py @@ -37,7 +37,7 @@ ensure_tainted(explicit_argv_parsing.foo) # $ tainted fake_args = parser.parse_args([""]) -ensure_not_tainted(fake_args.foo) # $ SPURIOUS: tainted +ensure_not_tainted(fake_args.foo) ######################################## # reading input from stdin diff --git a/python/ql/test/library-tests/modules/duplicate_name/Modules.expected b/python/ql/test/library-tests/modules/duplicate_name/Modules.expected index 45bd0378c226..bd3437af6501 100644 --- a/python/ql/test/library-tests/modules/duplicate_name/Modules.expected +++ b/python/ql/test/library-tests/modules/duplicate_name/Modules.expected @@ -1,3 +1 @@ | sqlite3 | 2 | 1 | -| sqlite3.__init__ | 2 | 1 | -| sqlite3.dump | 2 | 1 | diff --git a/python/ql/test/query-tests/Security/CWE-732-WeakFilePermissions/WeakFilePermissions.expected b/python/ql/test/query-tests/Security/CWE-732-WeakFilePermissions/WeakFilePermissions.expected index 3bfb6fe4f88a..762d2599c2d8 100644 --- a/python/ql/test/query-tests/Security/CWE-732-WeakFilePermissions/WeakFilePermissions.expected +++ b/python/ql/test/query-tests/Security/CWE-732-WeakFilePermissions/WeakFilePermissions.expected @@ -2,6 +2,5 @@ | test.py:8:1:8:20 | ControlFlowNode for Attribute() | Overly permissive mask in chmod sets file to world writable. | | test.py:9:1:9:21 | ControlFlowNode for Attribute() | Overly permissive mask in chmod sets file to world writable. | | test.py:11:1:11:21 | ControlFlowNode for Attribute() | Overly permissive mask in chmod sets file to group readable. | -| test.py:13:1:13:28 | ControlFlowNode for Attribute() | Overly permissive mask in chmod sets file to group writable. | | test.py:14:1:14:19 | ControlFlowNode for Attribute() | Overly permissive mask in chmod sets file to group writable. | | test.py:16:1:16:25 | ControlFlowNode for Attribute() | Overly permissive mask in open sets file to world readable. | diff --git a/python/ql/test/query-tests/Statements/no_effect/StatementNoEffect.expected b/python/ql/test/query-tests/Statements/no_effect/StatementNoEffect.expected index 5b1626128a44..9b534e55d7f1 100644 --- a/python/ql/test/query-tests/Statements/no_effect/StatementNoEffect.expected +++ b/python/ql/test/query-tests/Statements/no_effect/StatementNoEffect.expected @@ -1,3 +1,5 @@ +| assert_raises.py:9:13:9:19 | ExprStmt | This statement has no effect. | +| assert_raises.py:11:13:11:16 | ExprStmt | This statement has no effect. | | test.py:24:1:24:3 | ExprStmt | This statement has no effect. | | test.py:25:1:25:13 | ExprStmt | This statement has no effect. | | test.py:26:1:26:6 | ExprStmt | This statement has no effect. |