diff -r e046ae3e9628 Lib/wave.py --- a/Lib/wave.py Thu Oct 17 12:48:32 2013 +0300 +++ b/Lib/wave.py Thu Oct 17 21:48:23 2013 +0300 @@ -80,7 +80,7 @@ WAVE_FORMAT_PCM = 0x0001 -_array_fmts = None, 'b', 'h', None, 'l' +_array_fmts = None, 'b', 'h', None, 'i' import struct import sys @@ -244,6 +244,7 @@ import array chunk = self._data_chunk data = array.array(_array_fmts[self._sampwidth]) + assert data.itemsize == self._sampwidth nitems = nframes * self._nchannels if nitems * self._sampwidth > chunk.chunksize - chunk.size_read: nitems = (chunk.chunksize - chunk.size_read) // self._sampwidth @@ -433,6 +434,7 @@ if self._sampwidth > 1 and sys.byteorder == 'big': import array data = array.array(_array_fmts[self._sampwidth], data) + assert data.itemsize == self._sampwidth data.byteswap() data.tofile(self._file) self._datawritten = self._datawritten + len(data) * self._sampwidth