summaryrefslogtreecommitdiffstats
path: root/Lib/wave.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-04-12 22:55:07 (GMT)
committerGuido van Rossum <guido@python.org>2007-04-12 22:55:07 (GMT)
commitdc0b1a106981ee204936221f4e0863bd1d7a6ba6 (patch)
tree102949af2918a30ac4da920751e994c0df4af702 /Lib/wave.py
parentb6f1fdc90ca1f5826c5bd8e015a37563923144b5 (diff)
downloadcpython-dc0b1a106981ee204936221f4e0863bd1d7a6ba6.zip
cpython-dc0b1a106981ee204936221f4e0863bd1d7a6ba6.tar.gz
cpython-dc0b1a106981ee204936221f4e0863bd1d7a6ba6.tar.bz2
Make a few more tests pass with the new I/O library.
Fix the truncate() semantics -- it should not affect the current position. Switch wave.py/chunk.py to struct.unpack_from() to support bytes. Don't use writelines() on binary files (test_fileinput.py).
Diffstat (limited to 'Lib/wave.py')
-rw-r--r--Lib/wave.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/wave.py b/Lib/wave.py
index 08c51ba..dd5a47a 100644
--- a/Lib/wave.py
+++ b/Lib/wave.py
@@ -256,9 +256,9 @@ class Wave_read:
#
def _read_fmt_chunk(self, chunk):
- wFormatTag, self._nchannels, self._framerate, dwAvgBytesPerSec, wBlockAlign = struct.unpack('<hhllh', chunk.read(14))
+ wFormatTag, self._nchannels, self._framerate, dwAvgBytesPerSec, wBlockAlign = struct.unpack_from('<hhllh', chunk.read(14))
if wFormatTag == WAVE_FORMAT_PCM:
- sampwidth = struct.unpack('<h', chunk.read(2))[0]
+ sampwidth = struct.unpack_from('<h', chunk.read(2))[0]
self._sampwidth = (sampwidth + 7) // 8
else:
raise Error, 'unknown format: %r' % (wFormatTag,)