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

Nick Coghlan ncoghlan at gmail.com
Thu Apr 16 22:48:11 CEST 2015

On 16 Apr 2015 07:05, "Petr Viktorin" <encukou at gmail.com> wrote:
> Hello,
> Based on previous discussions, I've just sent a rewritten version of
> PEP 489 to the PEP editors. I'm including a copy below.

I like the general approach described in this version of the PEP.

> There's a question I need help with: go with a new PyModuleDesc
> structure, or stick with PyModuleDef and repurpose a currently unused
> member. You can find the details in the text itself.

I think the PEP makes a decent case for:

* m_reload being an essentially unimplementable idea
* swapping it out for a slots array pointer being a way to migrate to an
extensible approach to module declarations without needing a new struct
definition in the C API (and associated new functions to work with that

That means I'm inclined to favour the "modify PyModuleDef" variant.

> A wart I added is "singleton modules", necessary for
> "PyState_FindModule"-like functionality. I wouldn't mind not including
> this, but it would mean the new API can't replace all use cases of the
> old PyInit_.

I think the "wrapping a C library with global state" case is worth being
able to declare explicitly.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/import-sig/attachments/20150416/fa7b91a2/attachment-0001.html>

More information about the Import-SIG mailing list