PEP 765: Disallow return/break/continue that exit a finally block

It’s easier to respond to a SyntaxWarning pointing to the place in the code where the issue is, than to some random exception that started showing up when you upgraded to 3.14, and you don’t know where it’s coming from and why it didn’t happen in 3.13. How would you know that some finally used to suppress it?

Also, there were a handful of non-error cases where they did intend to suppress the error, and they assumed that the semantics are as stated in the documentation.

Indeed, I will add a section to the PEP about this.

2 Likes