New to C/Python extensions and I have been going through the default dict source code and stumbled upon the fact that the __missing__ function for default dict is called by the __getitem__ upon doing a check with PyDict_CheckExact.
Is default dict automatically considered a subclass by virtue of having a dictionary in its type definition and __missing__ function? If not, which part of defaultdict’s code defines it to be deriving dict? How does inheritance work between objects defined in C?
The ADD_TYPE line calls PyType_FromMetaclass which fills in the DEFERRED_ADDRESS used for tp_base.
The best way to learn how to make a subclass in a C extension is to read Modules/xxsubtype.c. That example is more straightforward than trying to read the indirect setup for defaultdict.