<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:arial,sans-serif">On Tue, Sep 12, 2017 at 5:53 PM, Stefan Krah </span><span dir="ltr" style="font-family:arial,sans-serif"><<a href="mailto:stefan@bytereef.org" target="_blank">stefan@bytereef.org</a>></span><span style="font-family:arial,sans-serif"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Sep 12, 2017 at 05:35:34PM +0300, Koos Zevenhoven wrote:<br>
> I don't see how the situation benefits from calling something the "main<br>
> interpreter". Subinterpreters can be a way to take something<br>
> non-thread-safe and make it thread-safe, because in an<br>
> interpreter-per-thread scheme, most of the state, like module globals, are<br>
> thread-local. (Well, this doesn't help for async concurrency, but anyway.)<br>
<br>
</span>You could have a privileged C extension that is only imported in the main<br>
interpreter:<br>
<br>
<br>
if get_current_interp() is main_interp():<br>
from _decimal import *<br>
else:<br>
from _pydecimal import *<br>
<br>
<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:monospace,monospace">Or it could be first-come first-served:</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">if is_imported_by_other_process("_decimal"):<br></div><div class="gmail_default" style="font-family:monospace,monospace"> from _pydecimal import *</div><div class="gmail_default" style="font-family:monospace,monospace">else</div><div class="gmail_default" style="font-family:monospace,monospace"> from _decimal import *</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">––Koos</div><br></div><div><br></div><div><br></div></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">+ Koos Zevenhoven + <a href="http://twitter.com/k7hoven" target="_blank">http://twitter.com/k7hoven</a> +</div>
</div></div>