mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Fixed crash (and now recognises correctly) {**d, "b": "b"}["b"]
This commit is contained in:
@@ -351,6 +351,12 @@ class SequenceLiteralContext(Sequence):
|
|||||||
kv = []
|
kv = []
|
||||||
iterator = iter(array_node.children)
|
iterator = iter(array_node.children)
|
||||||
for key in iterator:
|
for key in iterator:
|
||||||
|
if key == "**":
|
||||||
|
# dict with pep 448 double-star unpacking
|
||||||
|
# for now ignoring the values imported by **
|
||||||
|
next(iterator)
|
||||||
|
next(iterator, None) # Possible comma.
|
||||||
|
else:
|
||||||
op = next(iterator, None)
|
op = next(iterator, None)
|
||||||
if op is None or op == ',':
|
if op is None or op == ',':
|
||||||
kv.append(key) # A set.
|
kv.append(key) # A set.
|
||||||
|
|||||||
@@ -137,5 +137,15 @@ set_t2.c
|
|||||||
# -----------------
|
# -----------------
|
||||||
# python >= 3.5
|
# python >= 3.5
|
||||||
|
|
||||||
|
d = {'a': 3}
|
||||||
|
|
||||||
#? dict()
|
#? dict()
|
||||||
{**d}
|
{**d}
|
||||||
|
|
||||||
|
#? str()
|
||||||
|
{**d, "b": "b"}["b"]
|
||||||
|
|
||||||
|
# Should resolve to int() but jedi is not smart enough yet
|
||||||
|
# Here to make sure it doesn't result in crash though
|
||||||
|
#? str()
|
||||||
|
{**d, "b": "b"}["a"]
|
||||||
|
|||||||
Reference in New Issue
Block a user