From 5434ed973b2567aa7336b006d80325a10c6c78be Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 2 Sep 2015 13:32:44 -0400 Subject: [PATCH] Make sure locals in safe_eval is a plain dict when running eval Fixes #12206 --- lib/ansible/template/safe_eval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/template/safe_eval.py b/lib/ansible/template/safe_eval.py index 5e2d1e1fe3..300e634592 100644 --- a/lib/ansible/template/safe_eval.py +++ b/lib/ansible/template/safe_eval.py @@ -107,7 +107,7 @@ def safe_eval(expr, locals={}, include_exceptions=False): parsed_tree = ast.parse(expr, mode='eval') cnv.visit(parsed_tree) compiled = compile(parsed_tree, expr, 'eval') - result = eval(compiled, {}, locals) + result = eval(compiled, {}, dict(locals)) if include_exceptions: return (result, None)