fix(repl): Add local/global store operation in comprehension expressions#297
Open
Embers-of-the-Fire wants to merge 3 commits intopydantic:mainfrom
Open
fix(repl): Add local/global store operation in comprehension expressions#297Embers-of-the-Fire wants to merge 3 commits intopydantic:mainfrom
Embers-of-the-Fire wants to merge 3 commits intopydantic:mainfrom
Conversation
Collaborator
|
Thanks for the PR. This seems to me like a patch around what's probably a compiler bug. I think we can probably apply a better fix by doing something like PEP 709 - in monty the comprehensions are already inlined but we don't save / restore names either side of them as per the Would you be up for exploring an alternative fix which instead makes comprehensions match PEP 709 better? |
Contributor
Author
|
@davidhewitt Ok but that might take some more time :) I'm still working on this. |
3837866 to
7039cba
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Match PEP 709 more closely by saving and restoring synthetic comprehension slots instead of trimming hidden REPL globals afterward. This keeps comprehension temporaries from leaking across turns, exceptions, and pause/resume boundaries. Co-authored-by: OpenCode <noreply@openai.com>
7039cba to
1d130b4
Compare
MontyRepl turns
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.
Fixes #281 by force-clearing global slots left by list/generator comprehensions.