-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve handling of assignment expressions #4253
Improve handling of assignment expressions #4253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable. What kind of errors could go unnoticed ? Tests are still green which is a good sign 😄
Could you explain what you mean? Without this change the newly added tests would create |
Maybe I misunderstood your description I was referring to |
Yeah, take the following example: l1 = f'The number {(count1 := 4)} ' \
f'is equal to {count1}'
l2 = f'is equal to {count2}' \
f'The number {(count2 := 4)} '
Without this change, both |
Just FWI: This MR is would be ready for merge from my side. |
Steps
doc/whatsnew/<current release.rst>
.Description
Fixed some small issues with assignment expressions.
Multiline strings
This caused a
used-before-assignment
error in Python 3.8. The root cause is in the builtinast
module. Until 3.9, all nodes where parsed as being on the same line. I added some special case handling for it.However this might cause some errors to remain unnoticed!
Assignment expression with
Expr
Assignment expression with
AnnAssign
andAugAssign
--
I believe this could be included with
2.7.3
Type of Changes
Related Issue
Closes #3763
Closes #4238