On Tue, Apr 21, 2020 at 11:31 PM Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
To put it another way, the moment you start using subinterpreters, the set of extension modules you are able to use will shrink *enormously*.
Very true but we have to start somewhere.
And if I understand correctly, you won't get any nice "This module does not support subinterpreters" exception if you import an incompatible module -- just an obscure crash, probably of the core-dumping variety.
As Petr noted, we can use PEP 489 (Multi-phase Extension Module Initialization) support as an indicator and raise ImportError for any other extension modules (when in a subinterpreter). That seems like a reasonable way to avoid the hard-to-debug failures that would result otherwise. The only question I have is if it makes sense to offer a way to disable such a check (e.g. a flag when creating a subinterpreter). I think so, since then extension authors could more easily test their extension under subinterpreters without having to release a separate build that has PEP 489 support. -eric