Message276958
Please upload your patch from a Mercurial clone:
* https://docs.python.org/devguide/setup.html#checkout
* https://docs.python.org/devguide/patch.html
Currently, if you pass a string as a second argument, you get:
>>> complex(1, "1")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: complex() second arg can't be a string
So the exception message should probably be changed to include "second arg" or "second argument":
>>> complex(1j, {1: 2})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: complex() second arg must be a number, not 'dict'
Also, there is already a check for second argument in line 952 so the "must be a string" part is probably not needed. We probably need to check whether these two cases can be combined.
You also need to add some tests to Lib/test/test_complex.py. |
|
Date |
User |
Action |
Args |
2016-09-19 08:44:40 | berker.peksag | set | recipients:
+ berker.peksag, mark.dickinson, serhiy.storchaka, manishearth, soummyaah |
2016-09-19 08:44:40 | berker.peksag | set | messageid: <1474274680.15.0.532163187394.issue28203@psf.upfronthosting.co.za> |
2016-09-19 08:44:40 | berker.peksag | link | issue28203 messages |
2016-09-19 08:44:39 | berker.peksag | create | |
|