[Python-Dev] Changing PyModuleDef.m_reload to m_slots (original) (raw)
Stefan Behnel stefan_ml at behnel.de
Sat Apr 18 07:58:28 CEST 2015
- Previous message (by thread): [Python-Dev] Changing PyModuleDef.m_reload to m_slots
- Next message (by thread): [Python-Dev] Changing PyModuleDef.m_reload to m_slots
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Petr Viktorin schrieb am 17.04.2015 um 15:52:
As a background, the PyModuleDef structure [1] is currently:
struct PyModuleDef{ PyModuleDefBase mbase; const char* mname; const char* mdoc; Pyssizet msize; PyMethodDef *mmethods; inquiry mreload; traverseproc mtraverse; inquiry mclear; freefunc mfree; }; ... where the mreload pointer is unused, and must be NULL. My proposal is to repurpose this pointer to hold an array of slots, in the style of PEP 384's PyTypeSpec [2], which would allow adding extensions -- both those needed for PEP 489 and future ones.
FWIW, I'm +1 on this. It replaces a struct field that risks staying unused basically forever with an extensible interface that massively improves the current extension module protocol and allows future extensions (including getting back the pointer we replaced).
The alternative of essentially duplicating all sorts of things to accommodate for a new metadata struct is way too cumbersome and ugly in comparison.
Stefan
- Previous message (by thread): [Python-Dev] Changing PyModuleDef.m_reload to m_slots
- Next message (by thread): [Python-Dev] Changing PyModuleDef.m_reload to m_slots
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]