We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 249e737 commit 4550c11Copy full SHA for 4550c11
1 file changed
IPython/core/guarded_eval.py
@@ -866,20 +866,13 @@ def dummy_function(*args, **kwargs):
866
867
def _infer_return_value(node: ast.FunctionDef, context: EvaluationContext):
868
"""Execute the function body to infer its return value."""
869
- temp_context = EvaluationContext(
870
- globals=context.globals,
871
- locals=context.locals.copy(),
872
- evaluation=context.evaluation,
873
- in_subscript=context.in_subscript,
874
- transient_locals={},
875
- )
876
877
for stmt in node.body:
878
if isinstance(stmt, ast.Return):
879
if stmt.value is None:
880
return None
881
try:
882
- value = eval_node(stmt.value, temp_context)
+ value = eval_node(stmt.value, context)
883
if value is not NOT_EVALUATED:
884
return value
885
except Exception:
0 commit comments