Where does it says in the Python CAPI that if `__new__` does not return the class or an instance of it, `__init__` will not be called?

34 views Asked by At

In the Python's documentation, it is said that if the __new__ method of the class does not return either the class itself or an instance of it, the corresponding __init__ method will not be called.

Where is this implemented in the Python C-API?

I have searched through https://github.com/python/cpython/blob/main/Objects/typeobject.c#L3682 but could not find the relevant implementation.

0

There are 0 answers