Skip to content

[mypyc] Speed up and improve multiple assignment #9800

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

Merged
merged 9 commits into from
Dec 29, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test multiple assignments
  • Loading branch information
JukkaL committed Dec 12, 2020
commit f3d0f81e159c80a78e42dcc82419afaaddb6f88a
11 changes: 10 additions & 1 deletion mypyc/test-data/run-misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,15 @@ def from_list_complex(l: List[int]) -> List[int]:
def from_any(o: Any) -> List[Any]:
x, y = o
return [y, x]

def multiple_assignments(t: Tuple[int, str]) -> List[Any]:
a, b = c, d = t
e, f = g, h = 1, 2
return [a, b, c, d, e, f, g, h]
[file driver.py]
from native import from_tuple, from_tuple_sequence, from_list, from_list_complex, from_any
from native import (
from_tuple, from_tuple_sequence, from_list, from_list_complex, from_any, multiple_assignments
)

assert from_tuple((1, 'x')) == ['x', 1]

Expand Down Expand Up @@ -387,6 +394,8 @@ else:

assert from_any('xy') == ['y', 'x']

assert multiple_assignments((4, 'x')) == [4, 'x', 4, 'x', 1, 2, 1, 2]

[case testUnpack]
from typing import List

Expand Down