[issue39212] Show qualified function name when giving arguments error

Ram Rachum report at bugs.python.org
Sat Jan 4 13:52:25 EST 2020


New submission from Ram Rachum <ram at rachum.com>:

I recently got this familiar error:

    builtins.TypeError: __init__() takes 1 positional argument but 2 were given

It was annoying that I didn't know which `__init__` method was under discussion. I wish that Python used the `__qualname__` of the function to show this error message (and maybe others?) so it'll show like this: 

    builtins.TypeError: FooBar.__init__() takes 1 positional argument but 2 were given

If I'm not mistaken, the implementation of this error is in getargs.c in the function vgetargs1_impl.

----------
components: Interpreter Core
messages: 359302
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Show qualified function name when giving arguments error
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39212>
_______________________________________


More information about the Python-bugs-list mailing list