Berker Peksag added the comment:

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.

----------
nosy: +berker.peksag

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28203>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to