Skip to content

Commit 4550c11

Browse files
committed
use-original-context
1 parent 249e737 commit 4550c11

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

IPython/core/guarded_eval.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -866,20 +866,13 @@ def dummy_function(*args, **kwargs):
866866

867867
def _infer_return_value(node: ast.FunctionDef, context: EvaluationContext):
868868
"""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-
)
876869

877870
for stmt in node.body:
878871
if isinstance(stmt, ast.Return):
879872
if stmt.value is None:
880873
return None
881874
try:
882-
value = eval_node(stmt.value, temp_context)
875+
value = eval_node(stmt.value, context)
883876
if value is not NOT_EVALUATED:
884877
return value
885878
except Exception:

0 commit comments

Comments
 (0)