diff options
| author | Georg Brandl <georg@python.org> | 2010-11-20 11:29:09 (GMT) |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-11-20 11:29:09 (GMT) |
| commit | ef805a6b17198c11c357462ca581c065b4e722a8 (patch) | |
| tree | 309a5176eea7c87f8eb3130b522d11b7808a845a | |
| parent | a7d1d2401dc4017a0b028fc7270b13c74be9e8b3 (diff) | |
| download | cpython-ef805a6b17198c11c357462ca581c065b4e722a8.zip cpython-ef805a6b17198c11c357462ca581c065b4e722a8.tar.gz cpython-ef805a6b17198c11c357462ca581c065b4e722a8.tar.bz2 | |
Merged revisions 85970 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85970 | georg.brandl | 2010-10-30 10:29:28 +0200 (Sa, 30 Okt 2010) | 1 line
#10198: fix duplicate header when writeframes() is called with an empty string.
........
| -rw-r--r-- | Lib/wave.py | 6 | ||||
| -rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Lib/wave.py b/Lib/wave.py index 718e1eb..2016a2a 100644 --- a/Lib/wave.py +++ b/Lib/wave.py @@ -319,6 +319,7 @@ class Wave_write: self._nframeswritten = 0 self._datawritten = 0 self._datalength = 0 + self._headerwritten = False def __del__(self): self.close() @@ -449,7 +450,7 @@ class Wave_write: # def _ensure_header_written(self, datasize): - if not self._datawritten: + if not self._headerwritten: if not self._nchannels: raise Error, '# channels not specified' if not self._sampwidth: @@ -459,6 +460,7 @@ class Wave_write: self._write_header(datasize) def _write_header(self, initlength): + assert not self._headerwritten self._file.write('RIFF') if not self._nframes: self._nframes = initlength / (self._nchannels * self._sampwidth) @@ -472,8 +474,10 @@ class Wave_write: self._sampwidth * 8, 'data')) self._data_length_pos = self._file.tell() self._file.write(struct.pack('<l', self._datalength)) + self._headerwritten = True def _patchheader(self): + assert self._headerwritten if self._datawritten == self._datalength: return curpos = self._file.tell() @@ -91,6 +91,9 @@ Library - Issue #4471: Properly shutdown socket in IMAP.shutdown(). Patch by Lorenzo M. Catucci. +- Issue #10198: fix duplicate header written to wave files when writeframes() + is called without data. + - Issue #10126: Fix distutils' test_build when Python was built with --enable-shared. |
