8000 gh-112989: asyncio: Reduce overhead to connect sockets with SelectorEventLoop by bdraco · Pull Request #112991 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-112989: asyncio: Reduce overhead to connect sockets with SelectorEventLoop #112991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
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
14 changes: 5 additions & 9 deletions Lib/asyncio/selector_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,11 @@ def _ensure_fd_no_transport(self, fd):
except (AttributeError, TypeError, ValueError):
# This code matches selectors._fileobj_to_fd function.
raise ValueError(f"Invalid file object: {fd!r}") from None
try:
transport = self._transports[fileno]
except KeyError:
pass
else:
if not transport.is_closing():
raise RuntimeError(
f'File descriptor {fd!r} is used by transport '
f'{transport!r}')
transport = self._transports.get(fileno)
if transport and not transport.is_closing():
raise RuntimeError(
f'File descriptor {fd!r} is used by transport '
f'{transport!r}')

def _add_reader(self, fd, callback, *args):
self._check_closed()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce overhead to connect sockets with :mod:`asyncio` SelectorEventLoop.
0