Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use discard() instead of conditional remove()
  • Loading branch information
CendioOssman committed Feb 19, 2024
commit 69298883c83b4505a19aef8bef683f3ef6ec932f
3 changes: 1 addition & 2 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ def _attach(self, transport):
def _detach(self, transport):
# Note that 'transport' may already be missing from
# self._clients if it has been garbage collected
Copy link
Member

Choose a reason for hiding this comment

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

IMO you don't need this comment either (it was explaining the condition).

if transport in self._clients:
self._clients.remove(transport)
self._clients.discard(transport)
if len(self._clients) == 0 and self._sockets is None:
self._wakeup()

Expand Down