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

Guido van Rossum guido at python.org
Mon Aug 13 19:51:18 CEST 2007


Checked in. But next time please do use SF to submit patches (and feel
free to assign them to me and mail the list about it).

On 8/12/07, Victor Stinner <victor.stinner at haypocalc.com> wrote:
> 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')

This latter one is questionable. If you really want to compare to
bytes, perhaps write h[:1] == b'P' instead of b[0] == ord(b'P')?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list