[New-bugs-announce] [issue19686] possible unnecessary memoryview copies?

Lluís report at bugs.python.org
Fri Nov 22 00:46:46 CET 2013


New submission from Lluís:

The following code works without raising any AssertionError
 >>> n = "some small integer value"
 >>> m = "some larger integer value"
 >>> assert n<m
 >>> data = bytearray(n)
 >>> mem = memoryview(data)
 >>> assert mem==mem[:]
 >>> assert mem==mem[0:]
 >>> assert mem==mem[:m]

However, the different slices have different IDs, failing on the following asserts:
 >>> assert id(mem)==id(mem[:])
 >>> assert id(mem)==id(mem[0:])
 >>> assert id(mem)==id(mem[:m])

Is the interpreter copying unnecessary data in these type of slices?

----------
components: Library (Lib)
messages: 203700
nosy: Lluís
priority: normal
severity: normal
status: open
title: possible unnecessary memoryview copies?
type: enhancement

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


More information about the New-bugs-announce mailing list