Skip to content

gh-108903: Remove unneeded lambdas from asyncio #108904

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 1 commit into from
Sep 5, 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
4 changes: 2 additions & 2 deletions Doc/library/asyncio-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ received data, and close the connection::
loop = asyncio.get_running_loop()

server = await loop.create_server(
lambda: EchoServerProtocol(),
EchoServerProtocol,
'127.0.0.1', 8888)

async with server:
Expand Down Expand Up @@ -850,7 +850,7 @@ method, sends back received data::
# One protocol instance will be created to serve all
# client requests.
transport, protocol = await loop.create_datagram_endpoint(
lambda: EchoServerProtocol(),
EchoServerProtocol,
local_addr=('127.0.0.1', 9999))

try:
Expand Down
6 changes: 3 additions & 3 deletions Lib/asyncio/sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def _start_handshake(self):
# start handshake timeout count down
self._handshake_timeout_handle = \
self._loop.call_later(self._ssl_handshake_timeout,
lambda: self._check_handshake_timeout())
self._check_handshake_timeout)

self._do_handshake()

Expand Down Expand Up @@ -619,7 +619,7 @@ def _start_shutdown(self):
self._set_state(SSLProtocolState.FLUSHING)
self._shutdown_timeout_handle = self._loop.call_later(
self._ssl_shutdown_timeout,
lambda: self._check_shutdown_timeout()
self._check_shutdown_timeout
)
self._do_flush()

Expand Down Expand Up @@ -758,7 +758,7 @@ def _do_read__buffered(self):
else:
break
else:
self._loop.call_soon(lambda: self._do_read())
self._loop.call_soon(self._do_read)
except SSLAgainErrors:
pass
if offset > 0:
Expand Down