changeset: 101447:72946937536e branch: 3.5 parent: 101440:97198545e6c3 user: Victor Stinner date: Fri May 20 13:05:48 2016 +0200 files: Lib/asyncio/base_subprocess.py description: asyncio: fix ResourceWarning related to subprocesses Issue #26741: asyncio: BaseSubprocessTransport._process_exited() now copies the return code from the child watched to the returncode attribute of the Popen object. On Python 3.6, it is required to avoid a ResourceWarning. diff -r 97198545e6c3 -r 72946937536e Lib/asyncio/base_subprocess.py --- a/Lib/asyncio/base_subprocess.py Thu May 19 13:10:20 2016 -0700 +++ b/Lib/asyncio/base_subprocess.py Fri May 20 13:05:48 2016 +0200 @@ -210,6 +210,10 @@ logger.info('%r exited with return code %r', self, returncode) self._returncode = returncode + if self._proc.returncode is None: + # asyncio uses a child watcher: copy the status into the Popen + # object. On Python 3.6, it is required to avoid a ResourceWarning. + self._proc.returncode = returncode self._call(self._protocol.process_exited) self._try_finish()