New submission from Andrew Svetlov: Now those methods use lock for querying queue size, like
def qsize(self): with self.mutex: return self._qsize() The lock is not necessary because thread context switch may be done *after* returning from mutex protected code but *before* getting result by calling side. All three methods (qsize(), empty() and full()) gives *approximated value*, so getting rid of lock doesn't make it less stringent. ---------- components: Library (Lib) messages: 245029 nosy: asvetlov priority: low severity: normal status: open title: Drop redundant lock in queue.Queue methods qsize(), empty() and full() versions: Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24411> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com