Skip to content

[mypyc] Match evaluation order of multiple assignment from iterable (#793) #10444

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ChetanKhanna
Copy link
Contributor

Description

Refactored to iterate rvalues first before performing any assignments to match with Python semantics.

Closes mypyc/mypyc#793.

Test Plan

Added a new test case to test the unpacking with *x type lvalues

…ith Python (python#793)

Refactored to iterate rvalues first before performing any assignments.

Closes mypyc/mypyc#793.
@@ -607,6 +607,91 @@ L5:
L6:
return 1

[case testStarUnpack]
from typing import Any, List, Iterator
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testMultiAssignmentStarUnpack might be a better name?

r11 = 'y'
r12 = PyObject_SetAttr(a, r11, r6)
r13 = r12 >= 0 :: signed
r14 = PySequence_List(r3)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm should we do this before settings any attributes as well? It seems that we only partially evaluate the values to assign ahead of time if using star unpacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluation order of multiple assignment from iterable doesn't match Python
4 participants