summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-17 20:05:19 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-17 20:05:19 (GMT)
commit5b37f97ea5ac9f6b33b0e0269c69539cbb478142 (patch)
tree7b27304688f3e4eb754666494b3e0e8ca48863ea
parent2bb0ac0acec4b081838a308070747fdadd2d7939 (diff)
parentd3b750516f442911b8a35930b76a6953e4713556 (diff)
downloadcpython-5b37f97ea5ac9f6b33b0e0269c69539cbb478142.zip
cpython-5b37f97ea5ac9f6b33b0e0269c69539cbb478142.tar.gz
cpython-5b37f97ea5ac9f6b33b0e0269c69539cbb478142.tar.bz2
Issue #19276: Fixed the wave module on 64-bit big-endian platforms.
-rw-r--r--Lib/wave.py4
-rw-r--r--Misc/NEWS2
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/wave.py b/Lib/wave.py
index 1c6380e..0e6628b 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'
import struct
import sys
@@ -244,6 +244,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
@@ -433,6 +434,7 @@ class Wave_write:
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
diff --git a/Misc/NEWS b/Misc/NEWS
index 2a8bfd1..b20fc70 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,8 @@ Core and Builtins
Library
-------
+- Issue #19276: Fixed the wave module on 64-bit big-endian platforms.
+
- Issue #19266: Rename the new-in-3.4 ``contextlib.ignore`` context manager
to ``contextlib.suppress`` in order to be more consistent with existing
descriptions of that operation elsewhere in the language and standard