Skip to content

Commit da6736d

Browse files
authored
Merge pull request github#3668 from RasmusWL/python-random-modernisations
Python: Two small modernisations
2 parents 1b8f3c4 + f73876e commit da6736d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

python/ql/src/Classes/ShouldBeContextManager.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
import python
1616

17-
from ClassObject c
18-
where not c.isC() and not c.isContextManager() and exists(c.declaredAttribute("__del__"))
17+
from ClassValue c
18+
where not c.isBuiltin() and not c.isContextManager() and exists(c.declaredAttribute("__del__"))
1919
select c,
2020
"Class " + c.getName() +
2121
" implements __del__ (presumably to release some resource). Consider making it a context manager."

python/ql/src/analysis/RatioOfDefinitions.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import DefinitionTracking
77

88
predicate want_to_have_definition(Expr e) {
99
/* not builtin object like len, tuple, etc. */
10-
not exists(Object cobj | e.refersTo(cobj) and cobj.isC()) and
10+
not exists(Value builtin | e.pointsTo(builtin) and builtin.isBuiltin()) and
1111
(
1212
e instanceof Name and e.(Name).getCtx() instanceof Load
1313
or

0 commit comments

Comments
 (0)