Message169425
My perspective is that hashing a memoryview only makes sense when the memoryview is read-only and "m == m.tobytes()" (i.e. it's a C contiguous 1D view of bytes, either because that's what the original object exported as a buffer or because the view has been cast that way)
So, I think we should document that restriction in What's New and the memoryview docs for 3.3.0, and actually enforce it in 3.3.1 by raising ValueError from hash(m) when the assumption of a 1D C contiguous bytes view is violated (the "read-only" restriction is already enforced).
In previous versions, this constraint didn't need to be explicitly enforced, since memoryview basically treated *everything* as a 1D C contiguous view of bytes. |
|
Date |
User |
Action |
Args |
2012-08-30 00:26:03 | ncoghlan | set | recipients:
+ ncoghlan, loewis, georg.brandl, mark.dickinson, belopolsky, pitrou, vstinner, christian.heimes, Arfrever, skrah, meador.inge |
2012-08-30 00:26:03 | ncoghlan | set | messageid: <1346286363.03.0.00216010554927.issue15814@psf.upfronthosting.co.za> |
2012-08-30 00:26:01 | ncoghlan | link | issue15814 messages |
2012-08-30 00:26:00 | ncoghlan | create | |
|