[issue19158] BoundedSemaphore.release() subject to races

Tim Peters report at bugs.python.org
Tue Oct 8 18:58:13 CEST 2013


Tim Peters added the comment:

This is the "right" way to do it:  the subclass wants to extend the behavior of the base class .release(), not to replace it.  Calling the base class .release() is the natural and obvious way to do that.  It's also utterly normal for a lock used by multiple methods to be acquired & released multiple times - that's what an RLock is for.  What's odd to my eyes is that Semaphore - before the patch - went out of its way to _not_ use an RLock in its condition variable (Conditions use an RLock by default, for good reasons).

About acquire(), this is a bugfix - I'm not looking here to change code that isn't broken ;-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19158>
_______________________________________


More information about the Python-bugs-list mailing list