[Email-SIG] [Python-3000] fix email module for python 3000 (bytes/str)

Victor Stinner victor.stinner at haypocalc.com
Mon Aug 13 02:26:03 CEST 2007


On Sunday 12 August 2007 16:50:05 Barry Warsaw wrote:
> In r56957 I committed changes to sndhdr.py and imghdr.py so that they
> compare what they read out of the files against proper byte
> literals.

So nobody read my patches? :-( See my emails "[Python-3000] Fix imghdr module 
for bytes" and "[Python-3000] Fix sndhdr module for bytes" from last 
saturday. But well, my patches look similar.

Barry's patch is incomplete: test_voc() is wrong.

I attached a new patch:
 - fix "h[sbseek] == b'\1'" and "ratecode = ord(h[sbseek+4])" in test_voc()
 - avoid division by zero
 - use startswith method: replace h[:2] == b'BM' by h.startswith(b'BM')
 - use aifc.open() instead of old aifc.openfp()
 - use ord(b'P') instead of ord('P')

Victor Stinner aka haypo
http://hachoir.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py3k-imgsnd-hdr.patch
Type: text/x-diff
Size: 5326 bytes
Desc: not available
Url : http://mail.python.org/pipermail/email-sig/attachments/20070813/081c76b4/attachment.bin 


More information about the Email-SIG mailing list