From 665104e62603a0dd7adf44b40bc6decd941dcded Mon Sep 17 00:00:00 2001 From: Taus Date: Thu, 30 Oct 2025 23:08:11 +0000 Subject: [PATCH] Python: Fix Python 3 tests --- python/ql/test/3/extractor-tests/import_depth/test.ql | 1 + .../ql/test/3/library-tests/ControlFlow/Exceptions/Handles.ql | 1 + python/ql/test/3/library-tests/ControlFlow/Exceptions/Known.ql | 1 + python/ql/test/3/library-tests/ControlFlow/Exceptions/Likely.ql | 1 + .../ql/test/3/library-tests/ControlFlow/Exceptions/Unknown.ql | 1 + .../ql/test/3/library-tests/PointsTo/consts/BooleanConstants.ql | 2 +- python/ql/test/3/library-tests/PointsTo/inheritance/Calls.ql | 1 + python/ql/test/3/library-tests/PointsTo/metaclass/test.ql | 1 + .../PointsTo/regressions/subprocess-assert/ClassValue.ql | 1 + python/ql/test/3/library-tests/classes/attr/class_attr.ql | 1 + python/ql/test/3/library-tests/classes/attr/class_has_attr.ql | 1 + python/ql/test/3/library-tests/classes/meta/meta_obj.ql | 1 + python/ql/test/3/library-tests/classes/mro/mro.ql | 1 + python/ql/test/3/library-tests/classes/mro/mro_index.ql | 1 + .../test/3/library-tests/modules/general/moduleobject_test.ql | 1 + .../library-tests/modules/package_members/module_attributes.ql | 1 + .../3/library-tests/modules/package_members/module_exports.ql | 1 + .../3/library-tests/modules/package_members/module_import_as.ql | 1 + python/ql/test/3/library-tests/modules/usage/ModuleUsage.ql | 1 + python/ql/test/3/library-tests/types/classes/mro_test.ql | 1 + python/ql/test/3/library-tests/types/exceptions/Raises.ql | 1 + python/ql/test/3/library-tests/types/exceptions/Viable.ql | 1 + python/ql/test/3/library-tests/types/functions/Calls.ql | 1 + python/ql/test/3/library-tests/types/functions/Never.ql | 1 + python/ql/test/3/library-tests/types/functions/ReturnTypes.ql | 1 + python/ql/test/3/library-tests/types/namespaces/NameSpace.ql | 1 + .../test/3/library-tests/types/properties/BuiltinProperties.ql | 1 + 27 files changed, 27 insertions(+), 1 deletion(-) diff --git a/python/ql/test/3/extractor-tests/import_depth/test.ql b/python/ql/test/3/extractor-tests/import_depth/test.ql index ef626455fad..4f007e99468 100644 --- a/python/ql/test/3/extractor-tests/import_depth/test.ql +++ b/python/ql/test/3/extractor-tests/import_depth/test.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ModuleObject m /* Exclude the builtins module as it has a different name under 2 and 3. */ diff --git a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Handles.ql b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Handles.ql index 620944de5b9..60989ff8645 100644 --- a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Handles.ql +++ b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Handles.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ExceptFlowNode ex, Value val where ex.handledException(val, _, _) diff --git a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Known.ql b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Known.ql index 56498054f51..b773a172ee3 100644 --- a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Known.ql +++ b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Known.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from RaisingNode r select r.getLocation().getStartLine(), r.toString(), r.getARaisedType().toString() diff --git a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Likely.ql b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Likely.ql index f8e4a4b7dac..00cf5a7d2af 100644 --- a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Likely.ql +++ b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Likely.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ControlFlowNode r, ControlFlowNode s where diff --git a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Unknown.ql b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Unknown.ql index 29bad86bf0f..fe0fa6b0158 100644 --- a/python/ql/test/3/library-tests/ControlFlow/Exceptions/Unknown.ql +++ b/python/ql/test/3/library-tests/ControlFlow/Exceptions/Unknown.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from RaisingNode r where r.raisesUnknownType() diff --git a/python/ql/test/3/library-tests/PointsTo/consts/BooleanConstants.ql b/python/ql/test/3/library-tests/PointsTo/consts/BooleanConstants.ql index 4299e11d660..242fb5bc781 100644 --- a/python/ql/test/3/library-tests/PointsTo/consts/BooleanConstants.ql +++ b/python/ql/test/3/library-tests/PointsTo/consts/BooleanConstants.ql @@ -1,5 +1,5 @@ import python -import semmle.python.pointsto.PointsTo +private import LegacyPointsTo from ControlFlowNode f, Context c, boolean b where diff --git a/python/ql/test/3/library-tests/PointsTo/inheritance/Calls.ql b/python/ql/test/3/library-tests/PointsTo/inheritance/Calls.ql index f91d207fc70..3f111d6e08a 100644 --- a/python/ql/test/3/library-tests/PointsTo/inheritance/Calls.ql +++ b/python/ql/test/3/library-tests/PointsTo/inheritance/Calls.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from Call c, FunctionObject f where f.getACall().getNode() = c diff --git a/python/ql/test/3/library-tests/PointsTo/metaclass/test.ql b/python/ql/test/3/library-tests/PointsTo/metaclass/test.ql index 68eec976105..0644e4cdf74 100644 --- a/python/ql/test/3/library-tests/PointsTo/metaclass/test.ql +++ b/python/ql/test/3/library-tests/PointsTo/metaclass/test.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ClassObject cls where not cls.isC() diff --git a/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.ql b/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.ql index bc666b4f206..479ae6e5965 100644 --- a/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.ql +++ b/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/ClassValue.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo // as used in semmle.python.filters.Tests from ClassValue c, string base diff --git a/python/ql/test/3/library-tests/classes/attr/class_attr.ql b/python/ql/test/3/library-tests/classes/attr/class_attr.ql index 197ab1a1e5e..1c9c5513a1d 100644 --- a/python/ql/test/3/library-tests/classes/attr/class_attr.ql +++ b/python/ql/test/3/library-tests/classes/attr/class_attr.ql @@ -5,6 +5,7 @@ */ import python +private import LegacyPointsTo from ClassObject cls, int line, string name, Object obj where diff --git a/python/ql/test/3/library-tests/classes/attr/class_has_attr.ql b/python/ql/test/3/library-tests/classes/attr/class_has_attr.ql index be8272d1bd6..24724f4d859 100644 --- a/python/ql/test/3/library-tests/classes/attr/class_has_attr.ql +++ b/python/ql/test/3/library-tests/classes/attr/class_has_attr.ql @@ -5,6 +5,7 @@ */ import python +private import LegacyPointsTo from ClassObject cls, int line, string name where diff --git a/python/ql/test/3/library-tests/classes/meta/meta_obj.ql b/python/ql/test/3/library-tests/classes/meta/meta_obj.ql index e85127a9305..af46400ce00 100644 --- a/python/ql/test/3/library-tests/classes/meta/meta_obj.ql +++ b/python/ql/test/3/library-tests/classes/meta/meta_obj.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ClassObject cls where not cls.isC() diff --git a/python/ql/test/3/library-tests/classes/mro/mro.ql b/python/ql/test/3/library-tests/classes/mro/mro.ql index 576d6a75afd..86934f52c11 100644 --- a/python/ql/test/3/library-tests/classes/mro/mro.ql +++ b/python/ql/test/3/library-tests/classes/mro/mro.ql @@ -5,6 +5,7 @@ */ import python +private import LegacyPointsTo from ClassObject cls, ClassObject l, ClassObject r where diff --git a/python/ql/test/3/library-tests/classes/mro/mro_index.ql b/python/ql/test/3/library-tests/classes/mro/mro_index.ql index da40776044e..6a65d27b716 100644 --- a/python/ql/test/3/library-tests/classes/mro/mro_index.ql +++ b/python/ql/test/3/library-tests/classes/mro/mro_index.ql @@ -5,6 +5,7 @@ */ import python +private import LegacyPointsTo from ClassObject cls, ClassObject sup, int index where diff --git a/python/ql/test/3/library-tests/modules/general/moduleobject_test.ql b/python/ql/test/3/library-tests/modules/general/moduleobject_test.ql index a3a1ac6b185..db5b72e4dc4 100644 --- a/python/ql/test/3/library-tests/modules/general/moduleobject_test.ql +++ b/python/ql/test/3/library-tests/modules/general/moduleobject_test.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ModuleObject m, string name where not m.isC() and not m.getName() = "__future__" diff --git a/python/ql/test/3/library-tests/modules/package_members/module_attributes.ql b/python/ql/test/3/library-tests/modules/package_members/module_attributes.ql index 6c16450f313..f7755b92e12 100644 --- a/python/ql/test/3/library-tests/modules/package_members/module_attributes.ql +++ b/python/ql/test/3/library-tests/modules/package_members/module_attributes.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ModuleObject m, string name where not m.isC() diff --git a/python/ql/test/3/library-tests/modules/package_members/module_exports.ql b/python/ql/test/3/library-tests/modules/package_members/module_exports.ql index bcfc0c60bfb..d04ef3bc9f3 100644 --- a/python/ql/test/3/library-tests/modules/package_members/module_exports.ql +++ b/python/ql/test/3/library-tests/modules/package_members/module_exports.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ModuleObject m, string name where not m.isC() and m.exports(name) diff --git a/python/ql/test/3/library-tests/modules/package_members/module_import_as.ql b/python/ql/test/3/library-tests/modules/package_members/module_import_as.ql index 50ded7b4124..97cc2e86665 100644 --- a/python/ql/test/3/library-tests/modules/package_members/module_import_as.ql +++ b/python/ql/test/3/library-tests/modules/package_members/module_import_as.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ModuleObject m, string name where not m.isC() and m.importedAs(name) diff --git a/python/ql/test/3/library-tests/modules/usage/ModuleUsage.ql b/python/ql/test/3/library-tests/modules/usage/ModuleUsage.ql index 5f776e2374e..0469f804ab3 100644 --- a/python/ql/test/3/library-tests/modules/usage/ModuleUsage.ql +++ b/python/ql/test/3/library-tests/modules/usage/ModuleUsage.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ModuleValue mv, string usage where diff --git a/python/ql/test/3/library-tests/types/classes/mro_test.ql b/python/ql/test/3/library-tests/types/classes/mro_test.ql index 04b65ae2bef..4dc9bc153a2 100644 --- a/python/ql/test/3/library-tests/types/classes/mro_test.ql +++ b/python/ql/test/3/library-tests/types/classes/mro_test.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ClassObject cls, ClassObject sup where not cls.isC() diff --git a/python/ql/test/3/library-tests/types/exceptions/Raises.ql b/python/ql/test/3/library-tests/types/exceptions/Raises.ql index 2415c707967..e4f9a6664d5 100644 --- a/python/ql/test/3/library-tests/types/exceptions/Raises.ql +++ b/python/ql/test/3/library-tests/types/exceptions/Raises.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from PyFunctionObject f, string type where diff --git a/python/ql/test/3/library-tests/types/exceptions/Viable.ql b/python/ql/test/3/library-tests/types/exceptions/Viable.ql index bf00a0675d6..589e2630bb9 100644 --- a/python/ql/test/3/library-tests/types/exceptions/Viable.ql +++ b/python/ql/test/3/library-tests/types/exceptions/Viable.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from RaisingNode r, ControlFlowNode n, ClassObject ex where r.viableExceptionEdge_objectapi(n, ex) diff --git a/python/ql/test/3/library-tests/types/functions/Calls.ql b/python/ql/test/3/library-tests/types/functions/Calls.ql index 6fc188753e5..5eaeb4559b0 100644 --- a/python/ql/test/3/library-tests/types/functions/Calls.ql +++ b/python/ql/test/3/library-tests/types/functions/Calls.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from FunctionObject func, ControlFlowNode call where func.getACall() = call diff --git a/python/ql/test/3/library-tests/types/functions/Never.ql b/python/ql/test/3/library-tests/types/functions/Never.ql index 1e43ead7dce..932121d058e 100644 --- a/python/ql/test/3/library-tests/types/functions/Never.ql +++ b/python/ql/test/3/library-tests/types/functions/Never.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from FunctionObject func where func.neverReturns() diff --git a/python/ql/test/3/library-tests/types/functions/ReturnTypes.ql b/python/ql/test/3/library-tests/types/functions/ReturnTypes.ql index beb955e1188..d35deea34bf 100644 --- a/python/ql/test/3/library-tests/types/functions/ReturnTypes.ql +++ b/python/ql/test/3/library-tests/types/functions/ReturnTypes.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from PyFunctionObject func, ClassObject ret_type where func.getAnInferredReturnType() = ret_type diff --git a/python/ql/test/3/library-tests/types/namespaces/NameSpace.ql b/python/ql/test/3/library-tests/types/namespaces/NameSpace.ql index 38241e8fabc..f41d977d47b 100644 --- a/python/ql/test/3/library-tests/types/namespaces/NameSpace.ql +++ b/python/ql/test/3/library-tests/types/namespaces/NameSpace.ql @@ -6,6 +6,7 @@ */ import python +private import LegacyPointsTo from Scope s, string name, Object val where diff --git a/python/ql/test/3/library-tests/types/properties/BuiltinProperties.ql b/python/ql/test/3/library-tests/types/properties/BuiltinProperties.ql index 24766db9f2e..9ab0b5e4bbd 100644 --- a/python/ql/test/3/library-tests/types/properties/BuiltinProperties.ql +++ b/python/ql/test/3/library-tests/types/properties/BuiltinProperties.ql @@ -1,4 +1,5 @@ import python +private import LegacyPointsTo from ClassObject cls, string name, BuiltinPropertyObject p where