fix #12806, finally block gets skipped by 'break' inside try #24075
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is easiest to handle during linearization. The approach is to keep some state describing the currently active try-finally block, and have
return
andbreak
update that state to tell the finally block what to do after executing. This could also be extended pretty easily to handle arbitrarygoto
s.Some test cases shamelessly stolen from #13660.
It's not totally clear whether this should be backported, since it could subtly change the behavior of a program.