On Tue, Sep 12, 2017 at 05:35:34PM +0300, Koos Zevenhoven wrote:
> I don't see how the situation benefits from calling something the "main
> interpreter". Subinterpreters can be a way to take something
> non-thread-safe and make it thread-safe, because in an
> interpreter-per-thread scheme, most of the state, like module globals, are
> thread-local. (Well, this doesn't help for async concurrency, but anyway.)

You could have a privileged C extension that is only imported in the main
interpreter:


if get_current_interp() is main_interp():
    from _decimal import *
else:
    from _pydecimal import *



This is of course only attractive if importing the interpreters module
and calling these functions has minimal overhead.



Stefan Krah



_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to