Ben <benjsim...@gmail.com> added the comment:

You are right,

What one really needs here is a way to know *who* owns the lock,
but threading.Lock does not provide that.

The race on := is much smaller than the original race and I suspect in practice 
will be very hard to hit.

As the original bpo notes, it may not be possible to write a complete fix for 
this in pure Python, after all there may always be another interrupt between 
the `except` and the second attempted `release`.

The issue with the solution was that it turned a relatively hard-to-hit race 
condition into a really easy-to-hit one,  but perhaps the outcome is slightly 
less worse?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46726>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to