diff -r 961d832d8734 Lib/subprocess.py --- a/Lib/subprocess.py Wed Nov 20 12:49:05 2013 +0100 +++ b/Lib/subprocess.py Wed Nov 20 14:58:08 2013 +0100 @@ -1555,6 +1555,10 @@ class Popen(object): self._save_input(input) + # use a memoryview to avoid memory copies + if input: + input_view = memoryview(self._input) + with _PopenSelector() as selector: if self.stdin and input: selector.register(self.stdin, selectors.EVENT_WRITE) @@ -1576,8 +1580,8 @@ class Popen(object): for key, events in ready: if key.fileobj is self.stdin: - chunk = self._input[self._input_offset : - self._input_offset + _PIPE_BUF] + chunk = input_view[self._input_offset : + self._input_offset + _PIPE_BUF] try: self._input_offset += os.write(key.fd, chunk) except OSError as e: