mirror of
https://github.com/borgbackup/borg.git
synced 2026-05-28 04:03:21 -04:00
archive: closely wrap next() called from generator
lgtm: Calling next() in a generator may cause unintended early termination of an iteration. It seems that lgtm did not detect the more loose wrapping that we used before.
This commit is contained in:
parent
5cc2b900ee
commit
199f192a65
1 changed files with 4 additions and 4 deletions
|
|
@ -172,11 +172,11 @@ backup_io = BackupIO()
|
|||
def backup_io_iter(iterator):
|
||||
backup_io.op = 'read'
|
||||
while True:
|
||||
try:
|
||||
with backup_io:
|
||||
with backup_io:
|
||||
try:
|
||||
item = next(iterator)
|
||||
except StopIteration:
|
||||
return
|
||||
except StopIteration:
|
||||
return
|
||||
yield item
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue