forked from VimPlug/jedi
PEP 3132 unpacking should not raise an error (it may yield wrong results though at the moment), fixes #707.
This commit is contained in:
@@ -6,7 +6,8 @@ Changelog
|
|||||||
0.10.0 (2016-06-)
|
0.10.0 (2016-06-)
|
||||||
+++++++++++++++++
|
+++++++++++++++++
|
||||||
|
|
||||||
- Basic type inference for ``yield from`` and ``star unpacking``.
|
- Actual semantic completions for the complete Python syntax.
|
||||||
|
- Basic type inference for ``yield from`` PEP 380.
|
||||||
- PEP 484 support (most of the important features of it). Thanks Claude! (@reinhrst)
|
- PEP 484 support (most of the important features of it). Thanks Claude! (@reinhrst)
|
||||||
- Again a lot of internal changes.
|
- Again a lot of internal changes.
|
||||||
|
|
||||||
|
|||||||
@@ -533,6 +533,9 @@ def unpack_tuple_to_dict(evaluator, types, exprlist):
|
|||||||
# This is something that is not yet supported, would also be difficult
|
# This is something that is not yet supported, would also be difficult
|
||||||
# to write into a dict.
|
# to write into a dict.
|
||||||
return {}
|
return {}
|
||||||
|
elif exprlist.type == 'star_expr': # `a, *b, c = x` type unpackings
|
||||||
|
# Currently we're not supporting them.
|
||||||
|
return {}
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1487,7 +1487,7 @@ def _defined_names(current):
|
|||||||
if is_node(current, 'testlist_star_expr', 'testlist_comp', 'exprlist'):
|
if is_node(current, 'testlist_star_expr', 'testlist_comp', 'exprlist'):
|
||||||
for child in current.children[::2]:
|
for child in current.children[::2]:
|
||||||
names += _defined_names(child)
|
names += _defined_names(child)
|
||||||
elif is_node(current, 'atom'):
|
elif is_node(current, 'atom', 'star_expr'):
|
||||||
names += _defined_names(current.children[1])
|
names += _defined_names(current.children[1])
|
||||||
elif is_node(current, 'power', 'atom_expr'):
|
elif is_node(current, 'power', 'atom_expr'):
|
||||||
if current.children[-2] != '**': # Just if there's no operation
|
if current.children[-2] != '**': # Just if there's no operation
|
||||||
|
|||||||
@@ -401,3 +401,30 @@ def test_func():
|
|||||||
pass
|
pass
|
||||||
#? str()
|
#? str()
|
||||||
x
|
x
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# PEP 3132 Extended Iterable Unpacking (star unpacking)
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
a, *b, c = [1, 'b', list, dict]
|
||||||
|
#? int()
|
||||||
|
a
|
||||||
|
#? str()
|
||||||
|
b
|
||||||
|
#? list
|
||||||
|
c
|
||||||
|
|
||||||
|
# Not valid syntax
|
||||||
|
a, *b, *c = [1, 'd', list]
|
||||||
|
#? int()
|
||||||
|
a
|
||||||
|
#? str()
|
||||||
|
b
|
||||||
|
#? list
|
||||||
|
c
|
||||||
|
|
||||||
|
lc = [x for a, *x in [(1, '', 1.0)]]
|
||||||
|
|
||||||
|
#?
|
||||||
|
lc[0][0]
|
||||||
|
|||||||
Reference in New Issue
Block a user