From 37cfb5400deb7aa507c5077f1a27e2cc955e7951 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Wed, 10 Jun 2020 11:51:41 +0200 Subject: [PATCH 1/2] Python: Modernise RatioOfDefinitions --- python/ql/src/analysis/RatioOfDefinitions.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ql/src/analysis/RatioOfDefinitions.ql b/python/ql/src/analysis/RatioOfDefinitions.ql index 13bad7112b9..72a3fed0e69 100644 --- a/python/ql/src/analysis/RatioOfDefinitions.ql +++ b/python/ql/src/analysis/RatioOfDefinitions.ql @@ -7,7 +7,7 @@ import DefinitionTracking predicate want_to_have_definition(Expr e) { /* not builtin object like len, tuple, etc. */ - not exists(Object cobj | e.refersTo(cobj) and cobj.isC()) and + not exists(Value builtin | e.pointsTo(builtin) and builtin.isBuiltin()) and ( e instanceof Name and e.(Name).getCtx() instanceof Load or From f73876e6ce848e74fb35578f11438e7d508f5f0e Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Wed, 10 Jun 2020 11:53:11 +0200 Subject: [PATCH 2/2] Python: Modernise ShouldBeContextManager --- python/ql/src/Classes/ShouldBeContextManager.ql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ql/src/Classes/ShouldBeContextManager.ql b/python/ql/src/Classes/ShouldBeContextManager.ql index e6bf946b65a..fa7cebf9c77 100644 --- a/python/ql/src/Classes/ShouldBeContextManager.ql +++ b/python/ql/src/Classes/ShouldBeContextManager.ql @@ -14,8 +14,8 @@ import python -from ClassObject c -where not c.isC() and not c.isContextManager() and exists(c.declaredAttribute("__del__")) +from ClassValue c +where not c.isBuiltin() and not c.isContextManager() and exists(c.declaredAttribute("__del__")) select c, "Class " + c.getName() + " implements __del__ (presumably to release some resource). Consider making it a context manager."