Irit Katriel added the comment:
Reproduced on 3.11:
>>> def foo(): pass
...
>>> foo.__name__ = 'bar'
>>> foo(1)
Traceback (most recent call last):
File "", line 1, in
TypeError: foo() takes 0 positional arguments but 1 was given
--
nosy: +iritkatriel
versions: +Python 3.11
Martin Panter added the comment:
Issue 2786 currently proposes to pass __qualname__; if accepted that might also
satisfy this report.
--
dependencies: +Names in function call exception should have class names, if
they're methods
nosy: +martin.panter
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +berker.peksag
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4322
___
___
R. David Murray added the comment:
The 'Ex' generally means this is a public API but we needed to change it, so
we made a new function with an extended API. Which means yours would be
PyEval_EvalCodeExEx, I suppose :)
Seriously, though, I don't know what we actually do in a case like this.
Michele dos Santos da Silva added the comment:
func_name was not available on the places where the error strings are set
(PyErr_Format), so I added it and passed it around as needed.
This is the simplest approach, but I am not sure it is the best (newbie here).
Thus, I am waiting for your
Benjamin Peterson added the comment:
I think fixing this is a valid request.
--
resolution: invalid -
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4322
___
Changes by Jesús Cea Avión j...@jcea.es:
--
nosy: +jcea
stage: committed/rejected - needs patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4322
___
Changes by Jesús Cea Avión j...@jcea.es:
--
versions: +Python 3.4 -Python 3.0
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4322
___
___
Changes by R. David Murray rdmur...@bitdance.com:
--
resolution: - invalid
stage: - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4322
___
Benjamin Peterson [EMAIL PROTECTED] added the comment:
This is because these errors use the code object's name attribute
(f.func_code.co_name) for error messages.
--
nosy: +benjamin.peterson
priority: - normal
___
Python tracker [EMAIL PROTECTED]
New submission from Erick Tryzelaar [EMAIL PROTECTED]:
I ran into a case where I modified the __name__ attribute of a function
and then didn't specify the right number of arguments, and I got a
TypeError that used the original function name, as demonstrated here:
def foo(): pass
...
11 matches
Mail list logo