From 3f387f225c192227a43480e5181841970e1a9160 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 12 Feb 2019 23:14:13 -0800 Subject: [PATCH] Fix safe_eval on Python 3.8. --- lib/ansible/template/safe_eval.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/template/safe_eval.py b/lib/ansible/template/safe_eval.py index 3bbd3acbd4f..9c70be4a897 100644 --- a/lib/ansible/template/safe_eval.py +++ b/lib/ansible/template/safe_eval.py @@ -90,6 +90,14 @@ def safe_eval(expr, locals=None, include_exceptions=False): ) ) + # And in Python 3.6 too, although not encountered until Python 3.8, see https://bugs.python.org/issue32892 + if sys.version_info[:2] >= (3, 6): + SAFE_NODES.update( + set( + (ast.Constant,) + ) + ) + filter_list = [] for filter_ in filter_loader.all(): filter_list.extend(filter_.filters().keys())