Author mark.dickinson
Recipients aronacher, benjamin.peterson, georg.brandl, mark.dickinson
Date 2009-01-13.10:47:04
SpamBayes Score 0.000269835
Marked as misclassified No
Message-id <>
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')
>>> 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
>>> ast.literal_eval('-0.0+0.0j').real

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.
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: <>
2009-01-13 10:47:05mark.dickinsonlinkissue4907 messages
2009-01-13 10:47:04mark.dickinsoncreate