mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-12 19:29:11 -07:00
Fix dangerous default args. (#29839)
This commit is contained in:
parent
5caa47feb9
commit
68aeaa58a8
50 changed files with 253 additions and 87 deletions
|
@ -27,7 +27,7 @@ from ansible.module_utils.six.moves import builtins
|
|||
from ansible.plugins.loader import filter_loader, test_loader
|
||||
|
||||
|
||||
def safe_eval(expr, locals={}, include_exceptions=False):
|
||||
def safe_eval(expr, locals=None, include_exceptions=False):
|
||||
'''
|
||||
This is intended for allowing things like:
|
||||
with_items: a_list_variable
|
||||
|
@ -38,6 +38,7 @@ def safe_eval(expr, locals={}, include_exceptions=False):
|
|||
Based on:
|
||||
http://stackoverflow.com/questions/12523516/using-ast-and-whitelists-to-make-pythons-eval-safe
|
||||
'''
|
||||
locals = {} if locals is None else locals
|
||||
|
||||
# define certain JSON types
|
||||
# eg. JSON booleans are unknown to python eval()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue