Fix %foo? parsing in IPython assignment expressions#24152
Merged
charliermarsh merged 1 commit intomainfrom Mar 24, 2026
Merged
Conversation
%foo? parsing in IPython assignment expressions
|
MichaReiser
approved these changes
Mar 24, 2026
| } | ||
| continue; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
Can we add a comment explaining what we're handling here? Given the !context.allows_help_end, I assume this isn't a help end (but the comment above explains that we're lexing help end tokens here)
4f16d70 to
52079bc
Compare
carljm
added a commit
that referenced
this pull request
Mar 25, 2026
* main: [ty] Avoid eager TypedDict diagnostics in `TypedDict | dict` unions (#24151) `F507`: Fix false negative for non-tuple RHS in `%`-formatting (#24142) [ty] Update `SpecializationBuilder` hook to get both lower/upper bounds (#23848) Fix `%foo?` parsing in IPython assignment expressions (#24152) `E501`/`W505`/formatter: Exclude nested pragma comments from line width calculation (#24071) [ty] Fix Salsa panic propagation (#24141) [ty] Support `type:ignore[ty:code]` suppressions (#24096) [ty] Support narrowing for extended walrus targets (#24129)
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
We now distinguish between IPython escape commands lexed after an
=sign from those at the start of a logical line, which allowsx = %foo?to be interpreted as "assign the result of running a line magic namedfoo?", matching the IPython assignment-magic transform.See: #21705 (comment).