Bug report
Bug description:
Bug description:
In Lib/asyncio/queues.py, Queue.get() contains a redundant call to self.empty() inside its waiting loop:
async def get(self):
while self.empty():
if self._is_shutdown and self.empty(): # second self.empty() is redundant
raise QueueShutDown
self.empty() is guaranteed to be true by the enclosing while self.empty() the loop body cannot execute otherwise. This check is a dead code.
Proposed fix:
Drop the redundant and self.empty():
while self.empty():
if self._is_shutdown:
raise QueueShutDown
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Bug report
Bug description:
Bug description:
In
Lib/asyncio/queues.py,Queue.get()contains a redundant call toself.empty()inside its waiting loop:self.empty() is guaranteed to be true by the enclosing
while self.empty()the loop body cannot execute otherwise. This check is a dead code.Proposed fix:
Drop the redundant
and self.empty():CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs