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 seberg
Recipients seberg, vstinner
Date 2020-06-19.14:11:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1592575915.61.0.789948755318.issue41037@roundup.psfhosted.org>
In-reply-to
Content
In https://bugs.python.org/issue40826 it was defined that `PyOS_InterruptOccurred()` can only be called with a GIL.  NumPy had a few places with very unsafe sigint handling (not thread-safe).  But generally when we are in a situation that catching sigints would be nice as an enhancement, we do of course not hold the GIL.

So I am wondering if we can find some kind of thread-safe solution, or even just recipe.  Briefly looking at the code, it seemed to me that adding a new function with an additional `tstate` signature:

    PyOS_InterruptOccurred(PyThreadState *tstate)

Could work, and be a simple way to allow this in the future?  It is probably not high priority for us (NumPy had only one place where it tried to stop long running computations).
But right now I am unsure if the function has much use if it requires the GIL to be held and a `tstate=NULL` argument seemed reasonable (if it works), except that it adds a C-API name.
History
Date User Action Args
2020-06-19 14:11:55sebergsetrecipients: + seberg, vstinner
2020-06-19 14:11:55sebergsetmessageid: <1592575915.61.0.789948755318.issue41037@roundup.psfhosted.org>
2020-06-19 14:11:55seberglinkissue41037 messages
2020-06-19 14:11:55sebergcreate