]> www.infradead.org Git - users/dwmw2/openconnect.git/commit
Protect next() calls wit try/except inside generators
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Sun, 26 Sep 2021 12:45:39 +0000 (14:45 +0200)
committerDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Sat, 26 Feb 2022 15:51:05 +0000 (16:51 +0100)
commit4478dd532014ae244718ac5150deb1aacb1a5721
tree79e932605f00b9c15c60e3c6f13e072141b2987d
parentad22d92f424671f410e93a6fddf4fbf299c50e87
Protect next() calls wit try/except inside generators

This fixes a DeepSource alert:

Unguarded next inside generator

Calls to `next()` should be inside `try-except` block.

When the iterator is exhausted, `StopIteration` exception is raised. When
used inside a generator, this can cause unexpected behavior. If not
handled, it will propagate out of the generator causing termination.
PEP-479 has been accepted to fix this problem. It will modify the
behavior of `StopIteration` in generators.

Each call to `next()` should be wrapped in a `try-except` block to explicitly
handle `StopIteration` exceptions.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
 Veuillez saisir le message de validation pour vos modifications. Les lignes
test-f5-login.py
test-fortinet-login.py