diff options
Diffstat (limited to 'tests/functional/l/lost_exception.py')
| -rw-r--r-- | tests/functional/l/lost_exception.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/functional/l/lost_exception.py b/tests/functional/l/lost_exception.py new file mode 100644 index 000000000..c8fd3fe1f --- /dev/null +++ b/tests/functional/l/lost_exception.py @@ -0,0 +1,38 @@ +# pylint: disable=missing-docstring, using-constant-test,cell-var-from-loop + +def insidious_break_and_return(): + for i in range(0, -5, -1): + my_var = 0 + + try: + my_var += 1.0/i + if i < -3: + break + return my_var + finally: + if i > -2: + break # [lost-exception] + return my_var # [lost-exception] + return None + + +def break_and_return(): + for i in range(0, -5, -1): + my_var = 0 + if i: + break + try: + my_var += 1.0/i + finally: + for _ in range(2): + if True: + break + else: + def strange(): + if True: + return my_var + return None + strange() + if i: + break + return |
