Bugs in CPython 3.1.1 [wave.py]

Alf P. Steinbach alfps at start.no
Tue Jan 12 03:25:13 EST 2010


Argh! This was really annoying! Much time wasted (one naturally thinks that 
silly error must be one's own).

But, anyway:

Lines:

   244  nitems = (chunk.chunksize - chunk.size_read) / self._sampwidth
   464  self._nframes = initlength / (self._nchannels * self._sampwidth)

Need to use Python 3.x "//" integer division.

As a workaround, at least for writing wav-files (I haven't tested reading), one 
may just set the number of frames exactly before writing them.

That should also fix any problems with piping (avoiding file pos seek to patch 
up header).

Also, the unit test should best be improved to check that updating and 
backpatching of number of frames actually works.


PS: It would be nice if someone(TM) could describe here in detail how to 
properly report errors like this. Of course I'm not going to do it if it 
involves establishing Yet Another Account somewhere. But hopefully it doesn't?


Cheers & hth.,

- Alf



More information about the Python-list mailing list