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 vstinner
Recipients eryksun, gaborjbernat, pablogsal, serhiy.storchaka, vstinner
Date 2021-09-24.23:42:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632526930.37.0.135022912449.issue45274@roundup.psfhosted.org>
In-reply-to
Content
> I am not sure that it can be solved at Python level.

Right. In pure Python, we cannot write code which works in all cases. My PR 28532 fix the most common case: application interrupted by a single CTRL+C.

> with suppress_interrupt(): (...)

It's important to be able to interrupt acquire() which can be called in blocking mode with no timeout: it's exactly what tox does, and users expect to be able to interrupt tox in this case.

> * Add a Lock method (or just a builtin function) which acquires and immediately releases the lock, without possibility to interrupt.

The acquire()+release() sequence can be made atomic in C, but it doesn't solve the problem of _stop() which can be interrupted by a second exception.

This bug is likely as old as Python. I don't think that we should attempt to design a perfect solution. I only propose to make the race condition (way) less likely.
History
Date User Action Args
2021-09-24 23:42:10vstinnersetrecipients: + vstinner, serhiy.storchaka, eryksun, pablogsal, gaborjbernat
2021-09-24 23:42:10vstinnersetmessageid: <1632526930.37.0.135022912449.issue45274@roundup.psfhosted.org>
2021-09-24 23:42:10vstinnerlinkissue45274 messages
2021-09-24 23:42:10vstinnercreate