Author berker.peksag
Recipients berker.peksag, manishearth, mark.dickinson, serhiy.storchaka, soummyaah
Date 2016-09-19.08:44:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474274680.15.0.532163187394.issue28203@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-09-19 08:44:40berker.peksagsetrecipients: + berker.peksag, mark.dickinson, serhiy.storchaka, manishearth, soummyaah
2016-09-19 08:44:40berker.peksagsetmessageid: <1474274680.15.0.532163187394.issue28203@psf.upfronthosting.co.za>
2016-09-19 08:44:40berker.peksaglinkissue28203 messages
2016-09-19 08:44:39berker.peksagcreate