[New-bugs-announce] [issue39158] ast.literal_eval() doesn't support empty sets

Raymond Hettinger report at bugs.python.org
Sun Dec 29 16:42:10 EST 2019

New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:

We already support sets but not empty sets.  After the PR, this now works:

    >>> from ast import literal_eval
    >>> literal_eval('set()')

If we wanted, it would be a simple matter to extend it frozensets:

    >>> literal_eval('frozenset({10, 20, 30})')
    frozenset({10, 20, 30})

components: Library (Lib)
messages: 359007
nosy: rhettinger
priority: normal
severity: normal
status: open
title: ast.literal_eval() doesn't support empty sets
versions: Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list