summaryrefslogtreecommitdiffstats
path: root/Lib/wave.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-17 20:04:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-17 20:04:04 (GMT)
commitd3b750516f442911b8a35930b76a6953e4713556 (patch)
tree01cb37a57c7ee5e54ae23f2ad8ce90f10f8d64bc /Lib/wave.py
parent9ff06dcfad8d089251d5207cb1ce3ffb01885601 (diff)
downloadcpython-d3b750516f442911b8a35930b76a6953e4713556.zip
cpython-d3b750516f442911b8a35930b76a6953e4713556.tar.gz
cpython-d3b750516f442911b8a35930b76a6953e4713556.tar.bz2
Issue #19276: Fixed the wave module on 64-bit big-endian platforms.
Diffstat (limited to 'Lib/wave.py')
-rw-r--r--Lib/wave.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/wave.py b/Lib/wave.py
index 2c386a5..a1daead 100644
--- a/Lib/wave.py
+++ b/Lib/wave.py
@@ -80,7 +80,7 @@ class Error(Exception):
WAVE_FORMAT_PCM = 0x0001
-_array_fmts = None, 'b', 'h', None, 'l'
+_array_fmts = None, 'b', 'h', None, 'i'
# Determine endian-ness
import struct
@@ -238,6 +238,7 @@ class Wave_read:
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
@@ -421,6 +422,7 @@ class Wave_write:
if self._sampwidth > 1 and big_endian:
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