[issue19506] subprocess.communicate() should use a memoryview

STINNER Victor report at bugs.python.org
Tue Nov 5 21:34:46 CET 2013


New submission from STINNER Victor:

The following code copies data, whereas the copy can be avoided using a memory view:

chunk = self._input[self._input_offset:self._input_offset + _PIPE_BUF]
self._input_offset += os.write(key.fd, chunk)

It should be replaced with:

input_view = memoryview(self._input)
...
chunk = input_view[self._input_offset:self._input_offset + _PIPE_BUF]
self._input_offset += os.write(key.fd, chunk)


This issue is a reminder for one of my comment of issue #18923.

----------
messages: 202240
nosy: haypo, neologix
priority: normal
severity: normal
status: open
title: subprocess.communicate() should use a memoryview
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19506>
_______________________________________


More information about the Python-bugs-list mailing list