Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/asyncio/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async def get(self):
if the queue has been shut down immediately.
"""
while self.empty():
if self._is_shutdown and self.empty():
if self._is_shutdown:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just change the loop to while self.empty() and not self._is_shutdown:; get_nowait already rechecks all this stuff when it's called, and would raise the necessary exception for us.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer keeping this as is, so to keep the symmetry in the get() method.

raise QueueShutDown
getter = self._get_loop().create_future()
self._getters.append(getter)
Expand Down
Loading