mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-01 21:25:25 +08:00
A simple yield should not cause an error, fixes #1117
This commit is contained in:
@@ -205,9 +205,13 @@ def eval_atom(context, atom):
|
||||
# For False/True/None
|
||||
if atom.value in ('False', 'True', 'None'):
|
||||
return ContextSet(compiled.builtin_from_name(context.evaluator, atom.value))
|
||||
if atom.value == 'print':
|
||||
elif atom.value == 'print':
|
||||
# print e.g. could be evaluated like this in Python 2.7
|
||||
return NO_CONTEXTS
|
||||
elif atom.value == 'yield':
|
||||
# Contrary to yield from, yield can just appear alone to return a
|
||||
# value when used with `.send()`.
|
||||
return NO_CONTEXTS
|
||||
assert False, 'Cannot evaluate the keyword %s' % atom
|
||||
|
||||
elif isinstance(atom, tree.Literal):
|
||||
|
||||
@@ -208,6 +208,14 @@ def x():
|
||||
#? int()
|
||||
next(x())
|
||||
|
||||
# -----------------
|
||||
# statements
|
||||
# -----------------
|
||||
def x():
|
||||
foo = yield
|
||||
#?
|
||||
foo
|
||||
|
||||
# -----------------
|
||||
# yield from
|
||||
# -----------------
|
||||
|
||||
Reference in New Issue
Block a user