QUERY · ISSUE
Add .offset()/.seek() method for memoryview for inplace "slicing"
enhancementrfc
Here's an idiom to send a large data buffer thru a short-write stream (e.g., non-blocking socket):
buffer = memoryview(data).cast('b')
while buffer:
try:
nsent = self._socket_send(buffer, flags)
buffer = buffer[nsent:]
The last statement still produces bunch of object garbage. If we could do
buffer.offset(nsent)
it would be cool. Suggestions for better name are welcome.
CANDIDATE · PULL REQUEST
py/objarray: Fix constructing a memoryview from a memoryview.
py-core
Fixes issue #7261.
TODO:
- improve the test so it triggers the bug (prior to this fix) on bare metal boards