Hi,

One option to solve the https://bugs.python.org/issue40601 "[C API]
Hide static types from the limited C API" issue without breaking the
backward compatibility is to leave the C API and the stable ABI as
they are for the main interpreter (static types), but force
subinterpreters running in parallel to use their own heap types. It
means that subinterpreters would be able to use the main interpreter
GIL or own their GIL. By default, the GIL would still be shared.

C extensions using "&PyLongType" (static type) would continue to work
in the main interpreter.

C extensions which want to opt-in for running subinterpreters in
parallel would not access to "&PyLong_Type" but be forced to call
PyLong_GetType() (heap type).

Internally, Python should be modified to replace "&PyLongType" with
PyLong_GetType(). So the code would work with static types and heap
types.

It also means that a subinterpreter running in parallel would only be
able to import C extensions built with explicit support for this
feature. Otherwise, an ImportError would be raised.

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/QTY25AHCLOXRCQ2LADUUZFVKNVLLYS25/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to