Message113661
complex() raises ValueError when parsing a string argument containing both real and imaginary where one of the real or imaginary is a decimal.
To reproduce:
>>> complex("1.1 + 2.1j")
ValueError: complex() arg is a malformed string
>>> complex("2.1j")
2.1j
>>> complex("1.1 + 2j")
ValueError: complex() arg is a malformed string
>>> complex("1 + 2.1j")
ValueError: complex() arg is a malformed string
Expected results:
>>> complex("1.1 + 2.1j")
(1.1 + 2.1j)
>>> complex("2.1j")
2.1j
>>> complex("1.1 + 2j")
(1.1 + 2j)
>>> complex("1 + 2.1j")
(1 + 2.1j)
This affects all versions up to Python 3.1.2. I haven't tested any of the development builds.
Tests were conducted on a Windows XP 32 bit machine. |
|
Date |
User |
Action |
Args |
2010-08-12 07:12:42 | jdwhitley | set | recipients:
+ jdwhitley |
2010-08-12 07:12:42 | jdwhitley | set | messageid: <1281597162.74.0.823446392009.issue9574@psf.upfronthosting.co.za> |
2010-08-12 07:12:41 | jdwhitley | link | issue9574 messages |
2010-08-12 07:12:40 | jdwhitley | create | |
|