Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
ChetanKhanna wants to merge 4 commits intopython:masterfrom
ChetanKhanna:issue-793
Open

[mypyc] Match evaluation order of multiple assignment from iterable (#793)#10444
ChetanKhanna wants to merge 4 commits intopython:masterfrom
ChetanKhanna:issue-793

Conversation

@ChetanKhanna
Copy link
Copy Markdown
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

Comment thread mypyc/test-data/irbuild-statements.test Outdated
return 1

[case testStarUnpack]
from typing import Any, List, Iterator
Copy link
Copy Markdown
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?

Comment thread mypyc/test-data/irbuild-statements.test Outdated
r11 = 'y'
r12 = PyObject_SetAttr(a, r11, r6)
r13 = r12 >= 0 :: signed
r14 = PySequence_List(r3)
Copy link
Copy Markdown
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