Message390964
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__"] |
|
Date |
User |
Action |
Args |
2021-04-13 13:34:46 | vstinner | set | recipients:
+ vstinner |
2021-04-13 13:34:46 | vstinner | set | messageid: <1618320886.21.0.746257004386.issue43770@roundup.psfhosted.org> |
2021-04-13 13:34:46 | vstinner | link | issue43770 messages |
2021-04-13 13:34:46 | vstinner | create | |
|