[issue28203] complex() gives wrong error when the second argument has an invalid type

Soumya Sharma report at bugs.python.org
Tue Sep 20 08:03:09 EDT 2016


Soumya Sharma added the comment:

Changed error message to:

>>> complex({1:2},1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: complex() first arg must be a string or a number, not 'dict'

>>> 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'

Added tests to check the error raised.

----------
Added file: http://bugs.python.org/file44753/Issue28203#2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28203>
_______________________________________


More information about the Python-bugs-list mailing list