[issue34193] Fix pluralization in TypeError messages in getargs.c

Karthikeyan Singaravelan report at bugs.python.org
Tue Jul 24 08:58:46 EDT 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

Thanks, this needs to be fixed only in `check_num_args` and can help in all the other functions like __lt__, __delattr__ etc. in the file that use this.

Before suggestion : 

➜  cpython git:(bpo34193) ✗ ./python -c "a = {}; a.__delattr__()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: expected 1 arguments, got 0

After suggested change : 

➜  cpython git:(bpo34193) ✗ ./python -c "a = {}; a.__delattr__()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: expected 1 argument, got 0 


Is there some doc on clarification of the difference between 'required' argument and positional argument errors. I was trying to write to tests for the changes and I couldn't find functions that hit the exact branch of code. Some of them generate required argument error and some of them generate positional argument expected error. I looked up in the argument clinic docs (https://docs.python.org/3/howto/clinic.html) but it's little hard for me to grasp as a beginner. Any pointers will be helpful.


Thanks

----------

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


More information about the Python-bugs-list mailing list