-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Remove unnecessary LIST_TO_TUPLE
conversions
#126558
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 sound.
I thought this might break the following code:
def f():
for i in (*(l:= [1,2,3]),):
x = l.pop()
print(i)
It doesn't seem to as it builds a fresh list before converting it to a tuple, but could you add this code as a test case.
Otherwise things might break if we remove the extra LIST_EXTEND
When you're done making the requested changes, leave the comment: |
I have made the requested changes; please review again |
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
|
This probably doesn't need an issue or NEWS, it's just a little inefficiency @markshannon noticed earlier today. Basically, it doesn't matter if we're actually iterating over a tuple, so if we already have a list with the correct items, use that instead.