Serhiy Storchaka added the comment:

array's constructor interprets its second memoryview argument as an iterable of 
integers.

>>> import array
>>> array.array('h', b'abcd')
array('h', [25185, 25699])
>>> array.array('h', memoryview(b'abcd'))
array('h', [97, 98, 99, 100])

array.frombytes() always interpret its argument as bytes-like object.

>>> a = array.array('h')
>>> a.frombytes(memoryview(b'abcd'))
>>> a
array('h', [25185, 25699])

First patch fixes only a half of the issue. test_unseekable_incompleted_write() 
still failed because array.fromfile() fails read incomplete data. Second patch 
also adds unittest.expectedFailure decorators for these tests.

----------
Added file: http://bugs.python.org/file32680/wave_byteswap_2.patch

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

Reply via email to