This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients aronacher, benjamin.peterson, georg.brandl, mark.dickinson
Date 2009-01-13.10:47:04
SpamBayes Score 0.0002698352
Marked as misclassified No
Message-id <1231843625.94.0.123915977162.issue4907@psf.upfronthosting.co.za>
In-reply-to
Content
Nice fix!

Exactly which complex strings should be accepted here?
The patched version of literal-eval still accepts some
things that would be rejected as inputs to complex():

>>> ast.literal_eval('-1+-3j')
(-1-3j)
>>> complex('-1+-3j')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: complex() arg is a malformed string

and it produces different results from the complex
constructor in some other cases:

>>> complex('-0.0+0.0j').real
-0.0
>>> ast.literal_eval('-0.0+0.0j').real
0.0

But since I don't really know what ast_literal
is used for, I don't know whether this matters.

It still seems odd to me to be doing just one
special case of expression evaluation in
ast_literal, but maybe that's just me.
History
Date User Action Args
2009-01-13 10:47:06mark.dickinsonsetrecipients: + mark.dickinson, georg.brandl, benjamin.peterson, aronacher
2009-01-13 10:47:05mark.dickinsonsetmessageid: <1231843625.94.0.123915977162.issue4907@psf.upfronthosting.co.za>
2009-01-13 10:47:05mark.dickinsonlinkissue4907 messages
2009-01-13 10:47:04mark.dickinsoncreate