[Python-ideas] solving multi-core Python

Eric Snow ericsnowcurrently at gmail.com
Wed Jun 24 07:33:23 CEST 2015


On Sun, Jun 21, 2015 at 7:06 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Nick Coghlan schrieb am 21.06.2015 um 03:28:
>> * there may be restrictions on some extension modules that limit them
>> to "main interpreter only" (e.g. if the extension module itself isn't
>> thread-safe, then it will need to remain fully protected by the GIL)
>
> Just an idea, but C extensions could opt-in to this. Calling into them has
> to go through some kind of callable type, usually PyCFunction. We could
> protect all calls to extension types and C functions with a global runtime
> lock (per process, not per interpreter) and Extensions could set a flag on
> their functions and methods (or get it inherited from their extension types
> etc.) that says "I don't need the lock". That allows for a very
> fine-grained transition.

Exactly.  PEP 489 helps facilitate opting in as well, right?

-eric


More information about the Python-ideas mailing list