mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
Python: ObjectAPI to ValueAPI: IterReturnsNonIterator: Adds preliminary modernization
This commit is contained in:
@@ -12,17 +12,17 @@
|
||||
|
||||
import python
|
||||
|
||||
ClassObject return_type(FunctionObject f) {
|
||||
ClassValue return_type(FunctionValue f) {
|
||||
exists(ControlFlowNode n, Return ret |
|
||||
ret.getScope() = f.getFunction() and
|
||||
ret.getScope() = f.getScope() and
|
||||
ret.getValue() = n.getNode() and
|
||||
n.refersTo(_, result, _)
|
||||
result = n.pointsTo().getClass()
|
||||
)
|
||||
}
|
||||
|
||||
from ClassObject iterable, FunctionObject iter, ClassObject iterator
|
||||
from ClassValue iterable, FunctionValue iter, ClassValue iterator
|
||||
where
|
||||
iter = iterable.lookupAttribute("__iter__") and
|
||||
iter = iterable.lookup("__iter__") and
|
||||
iterator = return_type(iter) and
|
||||
not iterator.isIterator()
|
||||
select iterator,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| file://:Compiled Code:0:0:0:0 | builtin-class object | Class object is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:16:5:16:23 | Function __iter__ | __iter__ |
|
||||
| protocols.py:20:1:20:26 | class IteratorMissingNext | Class IteratorMissingNext is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:22:5:22:23 | Function __iter__ | __iter__ |
|
||||
| protocols.py:20:1:20:26 | class IteratorMissingNext | Class IteratorMissingNext is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:27:5:27:23 | Function __iter__ | __iter__ |
|
||||
| protocols.py:30:1:30:26 | class IteratorMissingIter | Class IteratorMissingIter is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:40:5:40:23 | Function __iter__ | __iter__ |
|
||||
| file://:0:0:0:0 | builtin-class object | Class object is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:16:5:16:23 | Function X.__iter__ | __iter__ |
|
||||
| protocols.py:20:1:20:26 | class IteratorMissingNext | Class IteratorMissingNext is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:22:5:22:23 | Function IteratorMissingNext.__iter__ | __iter__ |
|
||||
| protocols.py:20:1:20:26 | class IteratorMissingNext | Class IteratorMissingNext is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:27:5:27:23 | Function IterableMissingNext.__iter__ | __iter__ |
|
||||
| protocols.py:30:1:30:26 | class IteratorMissingIter | Class IteratorMissingIter is returned as an iterator (by $@) but does not fully implement the iterator interface. | protocols.py:40:5:40:23 | Function IterableMissingIter.__iter__ | __iter__ |
|
||||
|
||||
Reference in New Issue
Block a user