Message79730
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. |
|
Date |
User |
Action |
Args |
2009-01-13 10:47:06 | mark.dickinson | set | recipients:
+ mark.dickinson, georg.brandl, benjamin.peterson, aronacher |
2009-01-13 10:47:05 | mark.dickinson | set | messageid: <1231843625.94.0.123915977162.issue4907@psf.upfronthosting.co.za> |
2009-01-13 10:47:05 | mark.dickinson | link | issue4907 messages |
2009-01-13 10:47:04 | mark.dickinson | create | |
|