I have a doubt regarding the tp_init pointer in the struct PyTypeObject.
Does it point to the user defined _init_ or some other ??
I’m not sure: Type Object Structures — Python 3.14.3 documentation
1 Like
Yes, it points to the C implementation of __init__. Of course, it bears a slightly complex relationship to tp_new and type.__call__, but that is just the data model.
Now if the type is defined in Python, with an __init__ in Python, then this slot is made to contain a pointer to a wrapper function (in C) that dispatches to that Python method.
1 Like
thankyou….was looking for this…
thankyou!! This made the picture clearer!!