mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: Add test case for github/codeql#6227
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
| test.py:5:15:5:22 | ControlFlowNode for next() | Call to next() in a generator |
|
||||
| test.py:10:20:10:27 | ControlFlowNode for next() | Call to next() in a generator |
|
||||
| test.py:62:19:62:28 | ControlFlowNode for next() | Call to next() in a generator |
|
||||
|
||||
@@ -53,3 +53,12 @@ def ok5(seq):
|
||||
|
||||
def ok6(seq):
|
||||
yield next(iter([]), default='foo')
|
||||
|
||||
# Handling for multiple exception types, one of which is `StopIteration`
|
||||
# Reported as a false positive in github/codeql#6227
|
||||
def ok7(seq, ctx):
|
||||
try:
|
||||
with ctx:
|
||||
yield next(iter)
|
||||
except (StopIteration, MemoryError):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user