Skip to content

Commit 5fc1bbc

Browse files
committed
Python: Only alert on Python 2 code
since - Python 3 is ok from 3.7 onwards - support for Python 3.6 was just dropped - we do not actually know the minor version of the analysed code (only of the extractor)
1 parent afb5021 commit 5fc1bbc

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

python/ql/src/Exceptions/UnguardedNextInGenerator.ql

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,10 @@ where
6767
call.getNode().getScope().(Function).isGenerator() and
6868
not exists(Comp comp | comp.contains(call.getNode())) and
6969
not stop_iteration_handled(call) and
70-
// PEP 479 removes this concern from 3.5 onwards
70+
// PEP 479 removes this concern from 3.7 onwards
7171
// see: https://peps.python.org/pep-0479/
7272
//
73-
// However, testing it out, the problem is not removed until 3.7.
74-
(
75-
major_version() = 2
76-
or
77-
major_version() = 3 and minor_version() < 7
78-
)
73+
// However, we do not know the minor version of the analysed code (only of the extractor),
74+
// so we only alert on Python 2.
75+
major_version() = 2
7976
select call, "Call to next() in a generator"

python/ql/test/query-tests/Exceptions/generators/options

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)