Re: PEP 489: Redesigning extension module loading

Nick Coghlan <[email protected]> Fri, 3 Apr 2015 00:37:43 +1000
Newsgroups gmane.comp.python.import
Message-ID <CADiSq7c588E8GHyc+qtnY8D+2-+cTv0gxTx8dWzWtcXmdyNgKg@mail.gmail.com>
On 2 April 2015 at 21:05, Petr Viktorin <[email protected]> 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.

Regards,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia