[Import-SIG] PEP 489: Redesigning extension module loading

Nick Coghlan ncoghlan at gmail.com
Thu Apr 2 16:37:43 CEST 2015

On 2 April 2015 at 21:05, Petr Viktorin <encukou at gmail.com> wrote:
> There's another possibility I'm considering.
> PyModuleDef has a "m_reload" member, which is currently unused and must be
> set to NULL. Could we repurpose that to hold the slots?
> I realize renaming a member of a publicly available structure, and changing
> it from function pointer to data pointer, isn't a trivial change. But it
> shouldn;t break ABI. Maybe it can be made an union, for the rename case?
> Doing that would mean we wouldn't need additional
> PyState_AddModule/PyModule_GetDef equivalents, modules could avoid a
> md_slots member, and things like module_dealloc would only have one place to
> look for their hooks.
> In this scenario, flags could be implemented as a data-less slots,
> {Py_mod_flag_singleton, NULL}, or in a flag slot, {Py_mod_flags, &flags}.
> What do you think?

I think I don't have a clear enough picture of all the moving parts in
my head to follow what you're describing here without seeing it
written out :)

Probably the best thing to do if you're considering a couple of
different options is to list them both in the next PEP draft. You may
find a clear winner emerges while doing so, and if not, then we'll
have a solid reference for the options we're discussing.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Import-SIG mailing list