mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Allow set literals in literal_eval().
This commit is contained in:
parent
e40ee509e3
commit
492f3fc272
3 changed files with 10 additions and 3 deletions
|
@ -58,6 +58,8 @@ def literal_eval(node_or_string):
|
|||
return tuple(map(_convert, node.elts))
|
||||
elif isinstance(node, List):
|
||||
return list(map(_convert, node.elts))
|
||||
elif isinstance(node, Set):
|
||||
return set(map(_convert, node.elts))
|
||||
elif isinstance(node, Dict):
|
||||
return dict((_convert(k), _convert(v)) for k, v
|
||||
in zip(node.keys, node.values))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue