Allow set literals in literal_eval().

This commit is contained in:
Georg Brandl 2010-07-11 09:41:21 +00:00
parent e40ee509e3
commit 492f3fc272
3 changed files with 10 additions and 3 deletions

View file

@ -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))