mirror of
https://github.com/python/cpython.git
synced 2025-11-09 10:01:42 +00:00
gh-112989: asyncio: Reduce overhead to connect sockets with SelectorEventLoop (#112991)
_ensure_fd_no_transport had a KeyError in the success path
This commit is contained in:
parent
a3c031884d
commit
7e2d93f30b
2 changed files with 6 additions and 9 deletions
|
|
@ -261,15 +261,11 @@ def _ensure_fd_no_transport(self, fd):
|
||||||
except (AttributeError, TypeError, ValueError):
|
except (AttributeError, TypeError, ValueError):
|
||||||
# This code matches selectors._fileobj_to_fd function.
|
# This code matches selectors._fileobj_to_fd function.
|
||||||
raise ValueError(f"Invalid file object: {fd!r}") from None
|
raise ValueError(f"Invalid file object: {fd!r}") from None
|
||||||
try:
|
transport = self._transports.get(fileno)
|
||||||
transport = self._transports[fileno]
|
if transport and not transport.is_closing():
|
||||||
except KeyError:
|
raise RuntimeError(
|
||||||
pass
|
f'File descriptor {fd!r} is used by transport '
|
||||||
else:
|
f'{transport!r}')
|
||||||
if 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):
|
def _add_reader(self, fd, callback, *args):
|
||||||
self._check_closed()
|
self._check_closed()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Reduce overhead to connect sockets with :mod:`asyncio` SelectorEventLoop.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue