New submission from Ned Batchelder <n...@nedbatchelder.com>:
When a return statement also executes a finally clause, the sequence of lines reported to the trace function is different in 3.8 than it has been before 3.8: $ cat finally_trace.py def return_from_finally(): try: print("returning") return 17 finally: print("finally") def trace(frame, event, arg): print(frame.f_lineno, event) return trace import sys sys.settrace(trace) return_from_finally() $ python3.7 finally_trace.py 1 call 2 line 3 line returning 4 line 6 line finally 6 return $ python3.8 finally_trace.py 1 call 2 line 3 line returning 4 line 6 line finally 4 line 4 return Is this intentional? Is it a bug? Will it change back before 3.8 is shipped? ---------- components: Interpreter Core messages: 325484 nosy: nedbat priority: normal severity: normal status: open title: Python 3.8 changes how returns through finally clauses are traced type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34705> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com