We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 163bfc4 commit 0599e8aCopy full SHA for 0599e8a
python/ql/src/Exceptions/UnguardedNextInGenerator.ql
@@ -66,5 +66,12 @@ where
66
) and
67
call.getNode().getScope().(Function).isGenerator() and
68
not exists(Comp comp | comp.contains(call.getNode())) and
69
- not stop_iteration_handled(call)
+ not stop_iteration_handled(call) and
70
+ // PEP 479 removes this concern from 3.5 onwards
71
+ // see: https://peps.python.org/pep-0479/
72
+ (
73
+ major_version() = 2
74
+ or
75
+ major_version() = 3 and minor_version() < 5
76
+ )
77
select call, "Call to next() in a generator"
python/ql/test/query-tests/Exceptions/generators/options
@@ -0,0 +1 @@
1
+semmle-extractor-options: --lang=3 --version=3.2
0 commit comments