Memory errors with imaplib

Grant Edwards grante at visi.com
Mon Jan 21 11:04:25 EST 2008


On 2008-01-21, Christian Heimes <lists at cheimes.de> wrote:
> Grant Edwards wrote:
>
>> If the solution shown in the bug report is correct, I'd be
>> more than happy to generate a patch.
>
> The solution seems fine but IMO it should be fixed in the ssl
> socket and not in imaplib. I like to get it *fixed* and not
> *worked around*. :)

I've always been taught that you can't assume that a read on a
socket (ssl or otherwise) will return the number of bytes you
request.  You've always got to code for the case where read()
returns smaller chunks.  Maybe I've been taught wrongly, but
under Unix at least I've found that it's always a good practice
to assume that network reads will often return smaller chunks
than requested.

-- 
Grant Edwards                   grante             Yow! Are we on STRIKE yet?
                                  at               
                               visi.com            



More information about the Python-list mailing list