cpython: 41ed98a93236 (original) (raw)

Mercurial > cpython

changeset 85819:41ed98a93236 3.3

Issue #18950: Fix miscellaneous bugs in the sunau module. Au_read.readframes() now updates current file position and reads correct number of frames from multichannel stream. Au_write.writeframesraw() now correctly updates current file position. Au_read.getnframes() now returns an integer (as in Python 2). Au_read and Au_write now correctly works with file object if start file position is not a zero. [#18950]

Serhiy Storchaka storchaka@gmail.com
date Sat, 28 Sep 2013 21:21:39 +0300
parents 460b0ccbab7f
children 9e54def97a5e 6bf37e2cbe83
files Lib/sunau.py Misc/NEWS
diffstat 2 files changed, 28 insertions(+), 6 deletions(-)[+] [-] Lib/sunau.py 27 Misc/NEWS 7

line wrap: on

line diff

--- a/Lib/sunau.py +++ b/Lib/sunau.py @@ -205,6 +205,10 @@ class Au_read: break else: self._info = ''

def getfp(self): return self._file @@ -222,7 +226,7 @@ class Au_read: if self._data_size == AUDIO_UNKNOWN_SIZE: return AUDIO_UNKNOWN_SIZE if self._encoding in _simple_encodings:

def getcomptype(self): @@ -257,7 +261,8 @@ class Au_read: if nframes == AUDIO_UNKNOWN_SIZE: data = self._file.read() else:

@@ -265,8 +270,10 @@ class Au_read: return None # XXX--not implemented yet def rewind(self):

def tell(self): return self._soundpos @@ -274,7 +281,9 @@ class Au_read: def setpos(self, pos): if pos < 0 or pos > self.getnframes(): raise Error('position not in range')

def close(self): @@ -390,10 +399,10 @@ class Au_write: def writeframesraw(self, data): self._ensure_header_written()

@@ -455,6 +464,10 @@ class Au_write: length = AUDIO_UNKNOWN_SIZE else: length = self._nframes * self._framesize

@@ -464,7 +477,9 @@ class Au_write: self._file.write(b'\0'*(header_size - len(self._info) - 24)) def _patchheader(self):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -71,6 +71,13 @@ Core and Builtins Library ------- +- Issue #18950: Fix miscellaneous bugs in the sunau module.