This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author danieljewell
Recipients Gary Fernie, danieljewell, martin.panter, nubirstein, terry.reedy
Date 2020-05-13.20:16:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589400960.78.0.549264248926.issue26175@roundup.psfhosted.org>
In-reply-to
Content
To add something additional here:

The current documentation for tempfile.SpooledTemporaryFile indicates "This function operates exactly as TemporaryFile() does, except that data is spooled in memory until the file size exceeds max_size[...]" (see https://docs.python.org/3/library/tempfile.html)

Except that SpooledTemporaryFile *doesn't* act _exactly_ like TemporaryFile() - as documented here. TemporaryFile() returns an "_io.BufferedRandom" which implements all of the expected "file-like" goodies - like [.readable, .seekable, ...etc]. SpooledTemporaryFile does not.

In comparing to the 2.x docs, the text for SpooledTemporaryFile() appears to be identical or nearly identical to the 3.8.x current docs. This goes in line with what has already been discussed here.

At a _very minimum_ the documentation should be updated to reflect the current differences between TemporaryFile() and SpooledTemporaryFile(). 

Perhaps an easier change would be to extend TemporaryFile() to have a parameter that enables functionality similar to SpooledTemporaryFile? Namely, *memory-only* storage up to a max_size? Or perhaps there is an alternate solution that already exists? 

Ultimately, the functionality that appears to be missing is to be able to easily create a file-like object backed primarily by memory for reading/writing data ... (i.e. one 100% compatible with 'the usual' file objects returned by open()...)
History
Date User Action Args
2020-05-13 20:16:00danieljewellsetrecipients: + danieljewell, terry.reedy, martin.panter, Gary Fernie, nubirstein
2020-05-13 20:16:00danieljewellsetmessageid: <1589400960.78.0.549264248926.issue26175@roundup.psfhosted.org>
2020-05-13 20:16:00danieljewelllinkissue26175 messages
2020-05-13 20:16:00danieljewellcreate