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

Manish Goregaokar report at bugs.python.org
Mon Sep 19 03:41:46 EDT 2016


New submission from Manish Goregaokar:

When the second argument of complex() is not a number/string, the type error reports the error but prints the type of the first argument:

    > complex({1:2},1j)
    Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
    TypeError: complex() argument 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() argument must be a string or a number, not 'complex'
    >>> complex(1, {1:2})
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: complex() argument must be a string or a number, not 'int'

----------
components: Library (Lib)
messages: 276952
nosy: Manish Goregaokar
priority: normal
severity: normal
status: open
title: complex() gives wrong error when the second argument has an invalid type
type: enhancement
versions: Python 3.7

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


More information about the New-bugs-announce mailing list