[Python-ideas] solving multi-core Python

Stefan Behnel stefan_ml at behnel.de
Sun Jun 21 15:06:57 CEST 2015

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.


More information about the Python-ideas mailing list