Skip to content

Commit e4977c3

Browse files
committed
Use def instead of lambda assignments in asyncio.subprocess
1 parent 8a48959 commit e4977c3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/asyncio/subprocess.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ async def communicate(self, input=None):
206206
async def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
207207
limit=streams._DEFAULT_LIMIT, **kwds):
208208
loop = events.get_running_loop()
209-
protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,
210-
loop=loop)
209+
def protocol_factory():
210+
return SubprocessStreamProtocol(limit=limit, loop=loop)
211211
transport, protocol = await loop.subprocess_shell(
212212
protocol_factory,
213213
cmd, stdin=stdin, stdout=stdout,
@@ -219,8 +219,8 @@ async def create_subprocess_exec(program, *args, stdin=None, stdout=None,
219219
stderr=None, limit=streams._DEFAULT_LIMIT,
220220
**kwds):
221221
loop = events.get_running_loop()
222-
protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,
223-
loop=loop)
222+
def protocol_factory():
223+
return SubprocessStreamProtocol(limit=limit, loop=loop)
224224
transport, protocol = await loop.subprocess_exec(
225225
protocol_factory,
226226
program, *args,

0 commit comments

Comments
 (0)