This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2021-04-13.13:34:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1618320886.21.0.746257004386.issue43770@roundup.psfhosted.org>
In-reply-to
Content
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__"]
History
Date User Action Args
2021-04-13 13:34:46vstinnersetrecipients: + vstinner
2021-04-13 13:34:46vstinnersetmessageid: <1618320886.21.0.746257004386.issue43770@roundup.psfhosted.org>
2021-04-13 13:34:46vstinnerlinkissue43770 messages
2021-04-13 13:34:46vstinnercreate