diff options
author | Damien George <damien.p.george@gmail.com> | 2019-08-21 16:07:12 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-08-28 12:31:49 +1000 |
commit | 16f6169c88a5fd93b151149e561d177557fcc760 (patch) | |
tree | 9889ea0a1e34b56811b6d9931fa98aa270845cae /tests/misc/print_exception.py | |
parent | 3d7455a0bb4caa3e80e7594eaedd6e72c056ebe9 (diff) |
py/vm: Don't add traceback info for exc's propagated through a finally.
With this patch exception tracebacks that go through a finally are improved
(less confusing, match CPython), and it makes finally's slightly more
efficient (in time and RAM) because they no longer need to add a traceback.
Partially fixes issue #2928.
Diffstat (limited to 'tests/misc/print_exception.py')
-rw-r--r-- | tests/misc/print_exception.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/misc/print_exception.py b/tests/misc/print_exception.py index 95431632f..08b2e4bc4 100644 --- a/tests/misc/print_exception.py +++ b/tests/misc/print_exception.py @@ -47,6 +47,16 @@ except Exception as e: print('caught') print_exc(e) +# Test that an exception propagated through a finally doesn't have a traceback added there +try: + try: + f() + finally: + print('finally') +except Exception as e: + print('caught') + print_exc(e) + # Here we have a function with lots of bytecode generated for a single source-line, and # there is an error right at the end of the bytecode. It should report the correct line. def f(): |