fixed a bug with tuple indexing: a,b,c = (1,2)

This commit is contained in:
David Halter
2012-07-12 15:45:14 +02:00
parent cc081cdb3c
commit c84ca8f897
2 changed files with 25 additions and 2 deletions

View File

@@ -969,7 +969,10 @@ def assign_tuples(tup, results, seek_name):
types = [] types = []
for r in results: for r in results:
if hasattr(r, "get_exact_index_types"): if hasattr(r, "get_exact_index_types"):
types += r.get_exact_index_types(index) try:
types += r.get_exact_index_types(index)
except IndexError:
pass
else: else:
debug.warning("invalid tuple lookup %s of result %s in %s" debug.warning("invalid tuple lookup %s of result %s in %s"
% (tup, results, seek_name)) % (tup, results, seek_name))

View File

@@ -6,6 +6,10 @@
[1,""][0] [1,""][0]
#? str() #? str()
[1,""][1] [1,""][1]
#? int() str()
[1,""][2]
#? int() str()
[1,""][20]
a = list() a = list()
#? list() #? list()
@@ -92,7 +96,7 @@ u1
(u1) (u1)
# ----------------- # -----------------
# should fail (return nothing) # imbalanced sides
# ----------------- # -----------------
(f, g) = (1,) (f, g) = (1,)
#? int() #? int()
@@ -100,12 +104,26 @@ f
#? [] #? []
g. g.
(f, g, h) = (1,'')
#? int()
f
#? str()
g
#? []
h.
(f1, g1) = 1 (f1, g1) = 1
#? [] #? []
f1. f1.
#? [] #? []
g1. g1.
(f, g) = (1,'',1.0)
#? int()
f
#? str()
g
# ----------------- # -----------------
# dicts # dicts
# ----------------- # -----------------
@@ -118,3 +136,5 @@ dic2['asdf']
dic2[r'asdf'] dic2[r'asdf']
#? int() #? int()
dic2[r'asdf'] dic2[r'asdf']
#? int() str()
dic2['just_something']