diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-07-01 02:36:45 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-07-01 02:36:45 +0300 |
commit | 43df058e01710156e1b2a45cf070bfb0d4913169 (patch) | |
tree | fcfd84e4d8159b0319e822bd097144befbbd4e37 /astroid/protocols.py | |
parent | 34c346602a5a6b35fbe5abd23514f40f8f434288 (diff) | |
download | astroid-43df058e01710156e1b2a45cf070bfb0d4913169.tar.gz |
Star unpacking in assignments returns properly a list, not the individual components. Closes issue #138.
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r-- | astroid/protocols.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py index 586c1ec..95decef 100644 --- a/astroid/protocols.py +++ b/astroid/protocols.py @@ -439,6 +439,7 @@ def with_assigned_stmts(self, node, context=None, asspath=None): nodes.With.assigned_stmts = raise_if_nothing_infered(with_assigned_stmts) +@yes_if_nothing_infered def starred_assigned_stmts(self, node=None, context=None, asspath=None): stmt = self.statement() if not isinstance(stmt, (nodes.Assign, nodes.For)): @@ -486,8 +487,10 @@ def starred_assigned_stmts(self, node=None, context=None, asspath=None): elts.pop() continue # We're done - for elt in elts: - yield elt + packed = nodes.List() + packed.elts = elts + packed.parent = self + yield packed break nodes.Starred.assigned_stmts = starred_assigned_stmts |