ast.literal_eval: SyntaxError: unexpected EOF while parsing
<p>When trying to parse an empty string I get a <code>SyntaxError</code>. Why does it raise a different error than parsing a <code>'foo'</code>? In the source of <code>ast.literal_eval</code> only <code>ValueError</code> is explicitly raised.</p>

<pre><code>In [1]: import ast

In [2]: ast.literal_eval('foo')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-2-d8695a7c4a9f&gt; in &lt;module&gt;()
----&gt; 1 ast.literal_eval('foo')

/usr/lib/python2.7/ast.pyc in literal_eval(node_or_string)
     78                 return left - right
     79         raise ValueError('malformed string')
---&gt; 80     return _convert(node_or_string)
     81 
     82 

/usr/lib/python2.7/ast.pyc in _convert(node)
     77             else:
     78                 return left - right
---&gt; 79         raise ValueError('malformed string')
     80     return _convert(node_or_string)
     81 

ValueError: malformed string

In [3]: ast.literal_eval('')
  File "&lt;unknown&gt;", line 0

    ^
SyntaxError: unexpected EOF while parsing
</code></pre>
