summaryrefslogtreecommitdiffstats
path: root/Lib/ast.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-11 09:41:21 (GMT)
committerGeorg Brandl <georg@python.org>2010-07-11 09:41:21 (GMT)
commit492f3fc272a3b3e941f0911a1ef722065c58452e (patch)
treeef0c03388315f50c310fc87766fec3aee337c64e /Lib/ast.py
parente40ee509e35edd7dcab4009c4a65efc626527bb8 (diff)
downloadcpython-492f3fc272a3b3e941f0911a1ef722065c58452e.zip
cpython-492f3fc272a3b3e941f0911a1ef722065c58452e.tar.gz
cpython-492f3fc272a3b3e941f0911a1ef722065c58452e.tar.bz2
Allow set literals in literal_eval().
Diffstat (limited to 'Lib/ast.py')
-rw-r--r--Lib/ast.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/ast.py b/Lib/ast.py
index 0b8baf7..092f077 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -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))