gh-108903: Remove unneeded `lambda`s from `asyncio` (GH-108904)
diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst
index 7bc906e..9781bda 100644
--- a/Doc/library/asyncio-protocol.rst
+++ b/Doc/library/asyncio-protocol.rst
@@ -746,7 +746,7 @@
loop = asyncio.get_running_loop()
server = await loop.create_server(
- lambda: EchoServerProtocol(),
+ EchoServerProtocol,
'127.0.0.1', 8888)
async with server:
@@ -850,7 +850,7 @@
# 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:
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index 488e17d..3eb65a8 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -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()
@@ -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()
@@ -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: