Stefan Krah <ste...@bytereef.org> added the comment:
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. ---------- ______________________________________________ Python tracker <cpyt...@roundup.psfhosted.org> <https://bugs.python.org/issue35548> ______________________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com