diff options
| author | Gal Pressman <gal@nvidia.com> | 2026-01-25 12:55:24 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-01-26 19:32:20 -0800 |
| commit | a84a1fe0fb2e9bfccb1d5a2929a249960a93264d (patch) | |
| tree | 40119c145aeb7a81c02666baf3a94f087f2a860d /drivers/net/netdevsim/netdevsim.h | |
| parent | 3ccf393cdd091ad18be1135d19773d3739d09caa (diff) | |
selftests: net: fix wrong boolean evaluation in __exit__
The __exit__ method receives ex_type as the exception class when an
exception occurs. The previous code used implicit boolean evaluation:
terminate = self.terminate or (self._exit_wait and ex_type)
^^^^^^^^^^^
In Python, the and operator can be used with non-boolean values, but it
does not always return a boolean result.
This is probably not what we want, because 'self._exit_wait and ex_type'
could return the actual ex_type value (the exception class) rather than
a boolean True when an exception occurs.
Use explicit `ex_type is not None` check to properly evaluate whether
an exception occurred, returning a boolean result.
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20260125105524.773993-1-gal@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/netdevsim/netdevsim.h')
0 files changed, 0 insertions, 0 deletions
