bundles / IPython 9.10.0 / IPython / core / guarded_eval / eval_node
function
IPython.core.guarded_eval:eval_node
Signature
def eval_node ( node : Union[ast.AST, None] , context : EvaluationContext ) Summary
Evaluate AST node in provided context.
Extended Summary
Applies evaluation restrictions defined in the context. Currently does not support evaluation of functions with keyword arguments.
Does not evaluate actions that always have side effects:
class definitions (
class sth: ...)function definitions (
def sth: ...)variable assignments (
x = 1)augmented assignments (
x += 1)deletions (
del x)
Does not evaluate operations which do not return values:
assertions (
assert x)pass (
pass)imports (
import x)control flow:
conditionals (
if x:) except for ternary IfExp (a if x else b)loops (
forandwhile)exception handling
The purpose of this function is to guard against unwanted side-effects; it does not give guarantees on protection from malicious code execution.
Aliases
-
IPython.core.guarded_eval.eval_node