[Python-Dev] Pre-PEP: Redesigning extension modules

Stefan Behnel stefan_ml at behnel.de
Sun Sep 1 14:41:50 CEST 2013


Nick Coghlan, 01.09.2013 14:23:
> That means the powers any new extension initialisation API will offer
> will be limited to:
> 
> * letting the module know its own name (and other details)
> * letting the module explicitly block reloading
> * letting the module support loading multiple copies at once by taking
> the initial import out of sys.modules (but keeping a separate
> reference to it alive)

Which, all by themselves, can be considered a huge benefit, IMHO.

Plus, if we design the protocol broad enough now, specifically as a two-way
interface (info in, module out), we won't have to make any major changes to
it again anywhere in the near future, because incremental changes can just
be integrated into what's there then, in case we need any. It's sad that we
didn't see these requirements for Py3.0.


> In terms of where we go from here - do you mind if I use your pre-PEP
> as the initial basis for a PEP of my own some time in the next week or
> two (listing you as co-author)? Improving extension module
> initialisation has been the driver for most of the PEP 451 feedback
> I've been giving to Eric over on import-sig, so I have some definite
> ideas on how I think that API should look :)

Go for it. I'm not sure how much time I can actively spend on this during
the next weeks anyway, so I'm happy if this continues to get pushed onwards
in the meantime.

Stefan




More information about the Python-Dev mailing list