Nick Coghlan added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15814>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to