mirror of
https://github.com/github/codeql.git
synced 2026-01-11 13:40:21 +01:00
Merge pull request #3668 from RasmusWL/python-random-modernisations
Python: Two small modernisations
This commit is contained in:
@@ -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."
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user