Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Open
Description
Bug report
Bug description:
Consider this example:
>>>classA:...def__str__(self):return"some random text"...def__call__(self,a): ...>>>A()()Traceback (mostrecentcalllast):File"<python-input-16>",line1,in<module>A()()~~~^^TypeError:A.__call__()missing1requiredpositionalargument:'a'>>>A()(*None)Traceback (mostrecentcalllast):File"<python-input-17>",line1,in<module>A()(*None)~~~^^^^^^^TypeError:somerandomtextargumentafter*mustbeaniterable,notNoneType
The first one gets the callable's__qualname__. The second, on the other hand, does not, but should do so.
Another example, mentioned in#135975 (issuecomment link):
>>>exit(*None)Traceback (mostrecentcalllast):File"<python-input-0>",line1,in<module>exit(*None)~~~~^^^^^^^TypeError:Useexit()orCtrl-ZplusReturntoexitargumentafter*mustbeaniterable,notNoneType
Which just gets theexit's__repr__.
If this is recognized as unwanted behaviour, I'm ready to make a PR.
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Edit: ** also does not work properly:
# the code from the first example>>>A()(**1)Traceback (mostrecentcalllast):File"<python-input-26>",line1,in<module>A()(**1)~~~^^^^^TypeError:somerandomtextargumentafter**mustbeamapping,notint