Repository navigation
feat: try with exception edges, await and yield - #36
Merged
Merged
Conversation
This was referenced Sep 3, 2026
This was referenced Sep 4, 2026
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.
Summary
trywith exception edges, plusawaitandyield: the last open bullets of the PyHIR node set (#25) and of the CFG item (#11).test: define try, exception edges, await and yield behavior), implementation follows.TrywithExceptHandler(type, bound name, body),elseandfinally;AwaitandYieldexpressions.except*groups andyield fromstay explicit diagnostics.trybody carries exception edges to the handler blocks, so araiseor a call in the body can reach a handler;cfg.successorsandpredecessorsinclude them, and so do dominance, reachability and back edges. Handlers,elseandfinallyjoin after the statement;finallyis modelled on the normal path only, exceptional exits are an approximation. Integrity checks cover exception targets.try_1 [except: handler_1]:in--emit-ir), handlers start withcatch, andawait/yieldare instructions. SSA places phis at handlers and joins through the exception edges.finallybodies.--checkno longer reports functions usingtryas unsupported.Closes #25 (its last open bullets) and the exception-edges bullet of #11.