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.
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user