[issue6541] SpooledTemporaryFile operates differently to TemporaryFile

Leon Matthews report at bugs.python.org
Thu Jul 23 00:27:38 CEST 2009


Leon Matthews <leon at lost.co.nz> added the comment:

I've attached a patch to SpooledTemporaryFile (and its test class) to
remove the suprising exceptions.

SpooledTemporaryFile uses a io.StringIO for storage (in self._file)
until it reaches a certain size (or rollover() is called), at which
point it switches to a file object (or _TemporaryFileWrapper on
non-posix platforms).  This implementation detail should be abstracted
away from the user.

The interface mismatch there which caused an AttributeError to be thrown
-- but only if the file size was new, or below a certain size.

----------
keywords: +patch
Added file: http://bugs.python.org/file14542/SpooledTemporaryFile.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6541>
_______________________________________


More information about the Python-bugs-list mailing list