Re: PEP 489: Multi-phase extension module initialization; version 5
Antoine Pitrou <[email protected]> Mon, 18 May 2015 19:17:21 +0200
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <20150518191721.7bbde78f@fsol> |
On Mon, 18 May 2015 19:06:53 +0200 Petr Viktorin <[email protected]> wrote: > > > > The main problem is the PyState_FindModule() function. It's not > > terribly efficient, and most of all you have to check its return value > > for NULL. > > Ah, but that one is orthogonal to per-module state. The > PyState_FindModule is concerned with finding "the" module > corresponding to a given PyModuleDef in a given interpreter. > The problem it attempts to solve is that the module can't easily be > passed around to all the places that need it. You'd actually have the > exact same problem with a custom subclass -- it's finding the module > instance that's the problem, not getting data from it. That's a fair point. But it means the PEP won't help those stdlib modules which haven't been converted to PEP 3121, then. Regards Antoine.