Message332305
The reason is that unfortunately readonly != immutable, as the
following example shows:
>>> import numpy as np
>>> x = np.array([1,2,3], dtype='B')
>>> y = x[:]
>>> y.flags['WRITEABLE'] = False
>>> m = memoryview(y)
>>> m.readonly
True
>>> m.tolist()
[1, 2, 3]
>>> x[0] = 100
>>> m.tolist()
[100, 2, 3]
An object like 'y' is allowed to re-export memory, using its own flags. |
|
Date |
User |
Action |
Args |
2018-12-21 22:40:42 | skrah | set | recipients:
+ skrah, Kentzo |
2018-12-21 22:40:41 | skrah | set | messageid: <1545432041.85.0.377332604947.issue35548@roundup.psfhosted.org> |
2018-12-21 22:40:41 | skrah | link | issue35548 messages |
2018-12-21 22:40:41 | skrah | create | |
|