STINNER Victor <vstin...@python.org> added the comment:
If I modify type_ready() to call type_ready_inherit() before type_ready_fill_dict(), some types create a between between their C slot (tp_init) and the Python API in tp_dict (tp_dict["__init__"]). Example with importlib: class FileLoader(...): def __init__(...): ... => FileLoader.tp_init = slot_tp_init class SourceFileLoader(FileLoader): ... When PyType_Ready() is called on SourceFileLoader, we get: * SourceFileLoader.tp_base = FileLoader * SourceFileLoader.tp_init = NULL * SourceFileLoader.tp_dict has no "__init__" key When inherit_slots() is called, SourceFileLoader.tp_init is set to slot_tp_init(). When add_operators() is called, SourceFileLoader.tp_dict["__init__"] is set to PyDescr_NewWrapper(slot_tp_init). Problem: we a loop! tp_dict["__init__"] => slot_tp_init => tp_dict["__init__"] ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43770> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com