[issue5322] object.__new__ argument calling autodetection faulty

Irit Katriel report at bugs.python.org
Mon Jan 24 10:15:42 EST 2022


Irit Katriel <iritkatriel at gmail.com> added the comment:

Can we close this now?

>>> class A(object):
...     def __new__(self):
...          raise TypeError('i do not exist')
... 
>>> class B(A):
...     __new__ = object.__new__
...     def __init__(self, x):
...         self.x = x
... 
>>> B(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object.__new__() takes exactly one argument (the type to instantiate)
>>>

----------
nosy: +iritkatriel

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


More information about the Python-bugs-list mailing list