From: Victor Stinner Date: Thu, 20 Feb 2014 09:12:59 +0000 (+0100) Subject: asyncio.subprocess: Fix a race condition in communicate() X-Git-Tag: v3.4.1rc1~233^2~265 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cdb476bd438c7befec98913a6f1e770edd2f11a8;p=python 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. --- diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py index c3b0175552..414e02383e 100644 --- a/Lib/asyncio/subprocess.py +++ b/Lib/asyncio/subprocess.py @@ -146,7 +146,6 @@ class Process: @tasks.coroutine def communicate(self, input=None): - loop = self._transport._loop if input: stdin = self._feed_stdin(input) else: @@ -160,7 +159,7 @@ class Process: else: stderr = self._noop() stdin, stdout, stderr = yield from tasks.gather(stdin, stdout, stderr, - loop=loop) + loop=self._loop) yield from self.wait() return (stdout, stderr)