mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #10783: struct.pack() doesn't encode implicitly unicode to UTF-8
* Replace "bytes" by "bytes object" in struct error messages * Document the API change in What's new in Python 3.2 * Fix test_wave * Remove also ugly implicit conversions in test_struct
This commit is contained in:
parent
e398da9ad0
commit
da9ec995f6
6 changed files with 83 additions and 107 deletions
|
|
@ -467,11 +467,11 @@ class Wave_write:
|
|||
self._datalength = self._nframes * self._nchannels * self._sampwidth
|
||||
self._form_length_pos = self._file.tell()
|
||||
self._file.write(struct.pack('<l4s4slhhllhh4s',
|
||||
36 + self._datalength, 'WAVE', 'fmt ', 16,
|
||||
36 + self._datalength, b'WAVE', b'fmt ', 16,
|
||||
WAVE_FORMAT_PCM, self._nchannels, self._framerate,
|
||||
self._nchannels * self._framerate * self._sampwidth,
|
||||
self._nchannels * self._sampwidth,
|
||||
self._sampwidth * 8, 'data'))
|
||||
self._sampwidth * 8, b'data'))
|
||||
self._data_length_pos = self._file.tell()
|
||||
self._file.write(struct.pack('<l', self._datalength))
|
||||
self._headerwritten = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue