Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Commit 00c6c1b

Browse files
committed
asyncio.subprocess: Fix a race condition in communicate()
Use self._loop instead of self._transport._loop, because transport._loop is set to None at process exit.
1 parent 8228f01 commit 00c6c1b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

asyncio/subprocess.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def _read_stream(self, fd):
146146

147147
@tasks.coroutine
148148
def communicate(self, input=None):
149-
loop = self._transport._loop
150149
if input:
151150
stdin = self._feed_stdin(input)
152151
else:
@@ -160,7 +159,7 @@ def communicate(self, input=None):
160159
else:
161160
stderr = self._noop()
162161
stdin, stdout, stderr = yield from tasks.gather(stdin, stdout, stderr,
163-
loop=loop)
162+
loop=self._loop)
164163
yield from self.wait()
165164
return (stdout, stderr)
166165

0 commit comments

Comments
 (0)