mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
fixed possibility of StopIteration Exception to happen with wrong written ternary operators
This commit is contained in:
@@ -1217,7 +1217,10 @@ def follow_call_list(call_list):
|
|||||||
if str(call.name) == 'if':
|
if str(call.name) == 'if':
|
||||||
# Ternary operators.
|
# Ternary operators.
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
call = next(calls_iterator)
|
call = next(calls_iterator)
|
||||||
|
except StopIteration:
|
||||||
|
break
|
||||||
try:
|
try:
|
||||||
if str(call.name) == 'else':
|
if str(call.name) == 'else':
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -56,5 +56,10 @@ try:
|
|||||||
#? str()
|
#? str()
|
||||||
""
|
""
|
||||||
|
|
||||||
|
# wrong ternary
|
||||||
|
a = 1 if
|
||||||
|
#? int()
|
||||||
|
a
|
||||||
|
|
||||||
#? []
|
#? []
|
||||||
int()).
|
int()).
|
||||||
|
|||||||
2
test/completion/thirdparty/jedi_.py
vendored
2
test/completion/thirdparty/jedi_.py
vendored
@@ -32,5 +32,5 @@ el = list(evaluate.get_names_for_scope(1))[0][1]
|
|||||||
el = list(evaluate.get_names_for_scope())[0][1]
|
el = list(evaluate.get_names_for_scope())[0][1]
|
||||||
|
|
||||||
# TODO here should stand evaluate.Instance() and so on.
|
# TODO here should stand evaluate.Instance() and so on.
|
||||||
##? []
|
#?
|
||||||
el = list(evaluate.get_names_for_scope())[0][1][0]
|
el = list(evaluate.get_names_for_scope())[0][1][0]
|
||||||
|
|||||||
Reference in New Issue
Block a user