File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ def simple_eval(node_or_string, namespace=None):
8181
8282 The string or node provided may only consist of:
8383 * the following Python literal structures: strings, numbers, tuples,
84- lists, and dicts
84+ lists, dicts, sets (Python 3.9+)
8585 * variable names causing lookups in the passed in namespace or builtins
8686 * getitem calls using the [] syntax on objects of the types above
8787
@@ -113,6 +113,8 @@ def _convert(node):
113113 (_convert (k ), _convert (v ))
114114 for k , v in zip (node .keys , node .values )
115115 )
116+ elif sys .version_info [:2 ] >= (3 , 9 ) and isinstance (node , ast .Set ):
117+ return set (map (_convert , node .elts ))
116118
117119 # this is a deviation from literal_eval: we allow non-literals
118120 elif isinstance (node , _name_type_nodes ):
You can’t perform that action at this time.
0 commit comments