Message335947
The revised behaviour now makes the error messages consistent with each other:
>>> class TooManyArgs():
... def __new__(cls):
... super().__new__(cls, 1)
...
>>> TooManyArgs()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __new__
TypeError: object.__new__() takes exactly one argument (the type to instantiate)
>>> class NotEnoughArgs():
... def __new__(cls):
... super().__new__()
...
>>> NotEnoughArgs()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __new__
TypeError: object.__new__(): not enough arguments
>>> class TooManyInitArgs():
... def __init__(self):
... super().__init__(1, 2, 3)
...
>>> TooManyInitArgs()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __init__
TypeError: object.__init__() takes exactly one argument (the instance to initialize)
>>> class NotEnoughInitArgs():
... def __init__(self):
... object.__init__()
...
>>> NotEnoughInitArgs()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __init__
TypeError: descriptor '__init__' of 'object' object needs an argument |
|
Date |
User |
Action |
Args |
2019-02-19 13:48:34 | ncoghlan | set | recipients:
+ ncoghlan, serhiy.storchaka, CuriousLearner, miss-islington, xtreak, ppt000 |
2019-02-19 13:48:34 | ncoghlan | set | messageid: <1550584114.18.0.88389234135.issue31506@roundup.psfhosted.org> |
2019-02-19 13:48:34 | ncoghlan | link | issue31506 messages |
2019-02-19 13:48:34 | ncoghlan | create | |
|