Re: On singleton modules, heap types, and subinterpreters

Antoine Pitrou <[email protected]> Tue, 28 Jul 2015 15:52:46 +0200
Newsgroups gmane.comp.python.import
Message-ID <20150728155246.77fdcfe9@fsol>
On Sun, 26 Jul 2015 12:39:21 +0200
Petr Viktorin <[email protected]> wrote:
> 
> So, what options are there for methods of extension classes to get a
> hold of the module object (or module state)?

The "obvious" answer is to use the C equivalent of
`sys.modules[__name__]`. It should always do the right thing. However,
it's also quite inefficient and cumbersome to write.

Regards

Antoine.