Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I am opening this PR to keep a generator's frame-wide cleanup from swallowing later statements into an earlier exception handler. The code below currently decompiles with an extra
elsethat changes which values are yielded after a handled exception:Two sequential exception scopes must resume their shared mainline in order. The exception-chain extent walker can follow the generator/coroutine's frame-wide StopIteration conversion handler and absorb later mainline statements into an earlier lexical handler. In this example,
yield 3and the secondtryare moved into anelsebelonging to the firsttry, so they are skipped whenValueErroris handled.The change makes
chain_extentignore exception-table targets whose head isCALL_INTRINSIC_1 3. This target is frame cleanup, not a source-levelexceptorfinallycontinuation. The same correction applies to the asynchronous-generator variation, written asasync def select(work)with the same body.The relevant
CALL_INTRINSIC_1operation, includingINTRINSIC_STOPITERATION_ERROR, is introduced in Python 3.12.