| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f51c5e6 commit 99c601a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,7 +81,7 @@ def simple_eval(node_or_string, namespace=None): | |||
| 81 | 81 | ||
| 82 | 82 | The string or node provided may only consist of: | |
| 83 | 83 | * the following Python literal structures: strings, numbers, tuples, | |
| 84 | - lists, and dicts | ||
| 84 | + lists, dicts, sets (Python 3.9+) | ||
| 85 | 85 | * variable names causing lookups in the passed in namespace or builtins | |
| 86 | 86 | * getitem calls using the [] syntax on objects of the types above | |
| 87 | 87 | ||
@@ -113,6 +113,8 @@ def _convert(node): | |||
| 113 | 113 | (_convert(k), _convert(v)) | |
| 114 | 114 | for k, v in zip(node.keys, node.values) | |
| 115 | 115 | ) | |
| 116 | + elif sys.version_info[:2] >= (3, 9) and isinstance(node, ast.Set): | ||
| 117 | + return set(map(_convert, node.elts)) | ||
| 116 | 118 | ||
| 117 | 119 | # this is a deviation from literal_eval: we allow non-literals | |
| 118 | 120 | elif isinstance(node, _name_type_nodes): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments