Re: PEP 489: Multi-phase extension module initialization; version 5
Petr Viktorin <[email protected]> Mon, 18 May 2015 19:35:57 +0200
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CA+=+wqBsORsBGfJg9ggcB2ukqF9aW-d_G9-z9uEy_scSxyJYOA@mail.gmail.com> |
On Mon, May 18, 2015 at 7:17 PM, Antoine Pitrou <[email protected]> wrote: > 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. Correct. This is not the PEP you're looking for. Originally we did want to solve this problem, and I guess wording that suggests it's solved might still be around. Is that the case? Should I clarify that the problem is not yet solved? As the author, it's easy for me to lose track of the big picture.