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

Nick Coghlan ncoghlan at gmail.com
Mon Mar 16 14:12:42 CET 2015

This version looks good to me, although I noticed one significant typo
worth fixing.

On 16 March 2015 at 22:38, Petr Viktorin <encukou at gmail.com> wrote:
> Hello,
> On import-sig, I've agreed to continue Nick Coghlan's work on making
> extension modules act more like Python ones, work well with PEP 451
> (ModuleSpec), and encourage proper subinterpreter and reloading support.
> Here is the resulting PEP.
> I don't have a patch yet, but I'm working on it.
> There's a remaining open issue: providing a tool that can be run in test
> suites to check if a module behaves well with subinterpreters/reloading. I
> believe it's out of scope for this PEP but speak out if you disagree.

I no longer think we need a public testing API at this point, but I'd
like to ensure we have something in test.support or the importlib
tests that checks this for at least some of the stdlib extensions
modules (there may be something already, but if there is, I'm not sure
where it lives).

It also occurs to me we may need (or at least want) an explicit
"legacy style" import module as test fodder (to avoid accidentally
breaking that as stdlib modules get converted), as well as nominating
at least one stdlib extension module as the first module to be
converted to the new style as part of the initial implementation.

> Module Reloading
> ----------------
> Reloading an extension module will re-execute its PyModuleInit function.
> Similar caveats apply to reloading an extension module as to reloading
> a Python module. Notably, attributes or any other state of the module
> are not reset before reloading.

s/PyModuleInit/PyModuleExec/ here


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

More information about the Import-SIG mailing list