[issue4322] function with modified __name__ uses original name when there's an arg error

Irit Katriel report at bugs.python.org
Fri Nov 26 11:39:47 EST 2021


Irit Katriel <iritkatriel at gmail.com> added the comment:

Reproduced on 3.11: 

>>> def foo(): pass
... 
>>> foo.__name__ = 'bar'
>>> foo(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: foo() takes 0 positional arguments but 1 was given

----------
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.4

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


More information about the Python-bugs-list mailing list