Message302591
object_new and object_init currently use their own argument checking logic, and hence haven't benefited from the error reporting enhancements in PyArg_ParseTupleAndKeywords
Compare:
>>> str(1, 2, 3, 4, 5, x=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: str() takes at most 3 arguments (6 given)
>>> str(x=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'x' is an invalid keyword argument for this function
To:
>>> C(1, 2, 3, 4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object() takes no parameters
>>> C(x=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object() takes no parameters
Issue 31506 amends the latter to at least report the subclass name rather than the base class name, but doesn't cover any other enhancements, like reporting how many arguments were actually given, or the first unknown keyword argument name. |
|
Date |
User |
Action |
Args |
2017-09-20 05:17:57 | ncoghlan | set | recipients:
+ ncoghlan |
2017-09-20 05:17:57 | ncoghlan | set | messageid: <1505884677.44.0.281868370705.issue31527@psf.upfronthosting.co.za> |
2017-09-20 05:17:57 | ncoghlan | link | issue31527 messages |
2017-09-20 05:17:57 | ncoghlan | create | |
|