(original) (raw)

changeset: 87304:7b040bc289e8 branch: 3.3 parent: 87293:74b76a726285 user: Serhiy Storchaka storchaka@gmail.com date: Thu Nov 21 11:02:30 2013 +0200 files: Lib/test/audiotests.py Lib/test/test_wave.py Lib/wave.py Misc/NEWS description: Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on big-endian platforms. Temporary forbidden test_unseekable_incompleted_write fornot compressed 16- and 32-bit wave file on big-endian platforms. diff -r 74b76a726285 -r 7b040bc289e8 Lib/test/audiotests.py --- a/Lib/test/audiotests.py Wed Nov 20 17:43:49 2013 +0200 +++ b/Lib/test/audiotests.py Thu Nov 21 11:02:30 2013 +0200 @@ -6,7 +6,8 @@ import sys def byteswap2(data): - a = array.array('h', data) + a = array.array('h') + a.frombytes(data) a.byteswap() return a.tobytes() @@ -17,7 +18,8 @@ return bytes(ba) def byteswap4(data): - a = array.array('i', data) + a = array.array('i') + a.frombytes(data) a.byteswap() return a.tobytes() diff -r 74b76a726285 -r 7b040bc289e8 Lib/test/test_wave.py --- a/Lib/test/test_wave.py Wed Nov 20 17:43:49 2013 +0200 +++ b/Lib/test/test_wave.py Thu Nov 21 11:02:30 2013 +0200 @@ -48,6 +48,12 @@ if sys.byteorder != 'big': frames = audiotests.byteswap2(frames) + if sys.byteorder == 'big': + @unittest.expectedFailure + def test_unseekable_incompleted_write(self): + super().test_unseekable_incompleted_write() + + class WavePCM24Test(audiotests.AudioWriteTests, audiotests.AudioTestsWithSourceFile, @@ -108,6 +114,11 @@ if sys.byteorder != 'big': frames = audiotests.byteswap4(frames) + if sys.byteorder == 'big': + @unittest.expectedFailure + def test_unseekable_incompleted_write(self): + super().test_unseekable_incompleted_write() + if __name__ == '__main__': unittest.main() diff -r 74b76a726285 -r 7b040bc289e8 Lib/wave.py --- a/Lib/wave.py Wed Nov 20 17:43:49 2013 +0200 +++ b/Lib/wave.py Thu Nov 21 11:02:30 2013 +0200 @@ -424,7 +424,9 @@ data = self._convert(data) if self._sampwidth in (2, 4) and sys.byteorder == 'big': import array - data = array.array(_array_fmts[self._sampwidth], data) + a = array.array(_array_fmts[self._sampwidth]) + a.frombytes(data) + data = a assert data.itemsize == self._sampwidth data.byteswap() data.tofile(self._file) diff -r 74b76a726285 -r 7b040bc289e8 Misc/NEWS --- a/Misc/NEWS Wed Nov 20 17:43:49 2013 +0200 +++ b/Misc/NEWS Thu Nov 21 11:02:30 2013 +0200 @@ -13,6 +13,9 @@ Library ------- +- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on + big-endian platforms. + - Issue #19449: in csv's writerow, handle non-string keys when generating the error message that certain keys are not in the 'fieldnames' list. /storchaka@gmail.com