Skip to content

Commit ad1d6a1

Browse files
authored
gh-108903: Remove unneeded lambdas from asyncio (GH-108904)
1 parent 1e0d627 commit ad1d6a1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Doc/library/asyncio-protocol.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ received data, and close the connection::
746746
loop = asyncio.get_running_loop()
747747

748748
server = await loop.create_server(
749-
lambda: EchoServerProtocol(),
749+
EchoServerProtocol,
750750
'127.0.0.1', 8888)
751751

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

856856
try:

Lib/asyncio/sslproto.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def _start_handshake(self):
539539
# start handshake timeout count down
540540
self._handshake_timeout_handle = \
541541
self._loop.call_later(self._ssl_handshake_timeout,
542-
lambda: self._check_handshake_timeout())
542+
self._check_handshake_timeout)
543543

544544
self._do_handshake()
545545

@@ -619,7 +619,7 @@ def _start_shutdown(self):
619619
self._set_state(SSLProtocolState.FLUSHING)
620620
self._shutdown_timeout_handle = self._loop.call_later(
621621
self._ssl_shutdown_timeout,
622-
lambda: self._check_shutdown_timeout()
622+
self._check_shutdown_timeout
623623
)
624624
self._do_flush()
625625

@@ -758,7 +758,7 @@ def _do_read__buffered(self):
758758
else:
759759
break
760760
else:
761-
self._loop.call_soon(lambda: self._do_read())
761+
self._loop.call_soon(self._do_read)
762762
except SSLAgainErrors:
763763
pass
764764
if offset > 0:

0 commit comments

Comments
 (0)