Message368801
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()...) |
|
Date |
User |
Action |
Args |
2020-05-13 20:16:00 | danieljewell | set | recipients:
+ danieljewell, terry.reedy, martin.panter, Gary Fernie, nubirstein |
2020-05-13 20:16:00 | danieljewell | set | messageid: <1589400960.78.0.549264248926.issue26175@roundup.psfhosted.org> |
2020-05-13 20:16:00 | danieljewell | link | issue26175 messages |
2020-05-13 20:16:00 | danieljewell | create | |
|