[Python-3000] should rfc822 accept text io or binary io?

Guido van Rossum guido at python.org
Tue Aug 7 20:38:25 CEST 2007


On 8/7/07, Jeremy Hylton <jeremy at alum.mit.edu> wrote:
> We use the same makefile() object to read the headers and the body.
> We can't trust the body is text.  I guess we could change the code to
> use two different makefile() calls--a text one for headers that is
> closed when the headers are done, and a binary one for the body.

That would cause problems with the buffering, but it is safe to
extract the underlying binary buffered stream from the TextIOWrapper
instance using the .buffer attribute -- this is intentionally not
prefixed with an underscore.

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


More information about the Python-3000 mailing list