This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients eric.snow, vstinner
Date 2020-05-08.22:28:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588976931.16.0.539865430025.issue40572@roundup.psfhosted.org>
In-reply-to
Content
(This is a continuation of the work from bpo-33608.  That issue ended up with a lot of baggage and clutter (due to problems that have since been resolved), so we closed it.  This issue is where we're picking it up fresh.)

When two interpreters are cooperating, there are sometimes operations that one of them needs the other to perform.  Thus far this is limited to mutation or release of data/objects owned by that "other" interpreter.  We need safe, reliable public C-API to facilitate such operations.

All the necessary machinery already exists ("pending calls"), exposed in the internal C-API: _Py_AddPendingCall().  (There is a public Py_AddPendingCall(), but it should be removed.)  That API adds a function to a per-interpreter queue, from which it is executed later (asynchronously) by the ceval loop of the interpreter's main thread.  The challenge is that the repercussions of such async operations within the eval loop are not fully explored.  We have some confidence because this is the same machinery used to handle signals.  However, it's better avoid as much complexity in those async operations as possible.  That is why we don't just expose `_Py_AddPendingCall()` in the public C-API.

Instead the plan is to add a small number of public C-API functions that are each specific to a focused use case, ideally with with little/no chance of errors or other side effects.  Initially we will target `Py_DECREF()`, `PyMem_Free()`, and `PyBuffer_Release()`.  If we need more then we can assess those needs later.
History
Date User Action Args
2020-05-08 22:28:51eric.snowsetrecipients: + eric.snow, vstinner
2020-05-08 22:28:51eric.snowsetmessageid: <1588976931.16.0.539865430025.issue40572@roundup.psfhosted.org>
2020-05-08 22:28:51eric.snowlinkissue40572 messages
2020-05-08 22:28:49eric.snowcreate