Author vstinner
Recipients vstinner
Date 2020-05-06.15:11:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588777895.61.0.395509624257.issue40533@roundup.psfhosted.org>
In-reply-to
Content
To get one GIL per interpreter (bpo-40512), either PyObject.ob_refcnt member must become an atomic variable, or subinterpreters must not share any object.

Right now, subinterpreters share Python objects. For example, PyModule_Type is declared statically and so shared by all interpreters and so PyModule_Type.tp_mro tuple is accessed in parallel by multiple interpreters. If PyObject.ob_refcnt is not atomic, Py_INCREF() and Py_DECREF() are unsafe and tp_mro tuple can be destroyed whereas it is still used.

I propose to make PyObject.ob_refcnt atomic for now, when Python is built with EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro defined. It's a temporary workaround until subinterpreters stop sharing objects.
History
Date User Action Args
2020-05-06 15:11:35vstinnersetrecipients: + vstinner
2020-05-06 15:11:35vstinnersetmessageid: <1588777895.61.0.395509624257.issue40533@roundup.psfhosted.org>
2020-05-06 15:11:35vstinnerlinkissue40533 messages
2020-05-06 15:11:35vstinnercreate