[issue32768] object.__new__ does not accept arguments if __bases__ is changed
Alexey Muranov
report at bugs.python.org
Tue May 7 03:45:43 EDT 2019
Alexey Muranov <alexey.muranov at gmail.com> added the comment:
IMO "overriding" a method with itself should not change the behaviour. So it seems to me that the following is a bug:
class C:
def __init__(self, m):
print(m)
class D:
@staticmethod
def __new__(cls, *args, **kwargs):
return super(__class__, __class__).__new__(cls, *args, **kwargs)
def __init__(self, m):
print(m)
C(42) # fine
D(42) # TypeError: object.__new__() takes exactly one argument
Of course such overriding makes little sense in itself, but forbidding it makes even less sense and creates bugs in more complex scenarios.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32768>
_______________________________________
More information about the Python-bugs-list
mailing list