[issue22988] No error when yielding from `finally`
Felipe added the comment:
Thanks for the clarification; sorry I misread issue #14718.
I agree with Ethan's point. Though I would say "Yield expressions are allowed anywhere in try ... except ... finally constructs."
I'd also like to explicitly add a point about the exception-handling machinery getting frozen, but I'm not sure how to phrase it clearly and accurately. Here's an attempt (my adds in square brackets):
"By suspended, we mean that all local state is retained, including the current bindings of local variables, the instruction pointer, the internal evaluation stack, [active exception handlers, and paused exceptions in finally blocks]."
Another approach would be: "By suspended, we mean that all local state is retained, including the current bindings of local variables, the instruction pointer, and the internal evaluation stack. [The state of any exception-handling code is also retained when yielding from a try ... except ... finally statement.]"
_______________________________________ Python tracker firstname.lastname@example.org http://bugs.python.org/issue22988 _______________________________________