[issue40287] SpooledTemporaryFile.seek returns None
amcinnes
report at bugs.python.org
Tue Apr 14 21:41:51 EDT 2020
New submission from amcinnes <angus at amcinnes.info>:
The documentation says SpooledTemporaryFile "operates exactly as TemporaryFile() does".
seek() would be expected to return the new absolute position; this is what it does for TemporaryFile, and is the documented behaviour of seek() in IOBase. But for SpooledTemporaryFile it returns None.
Probably trivial to fix by sticking a "return" on https://github.com/python/cpython/blob/0361556537686f857f1025ead75e6af4ca7cc94a/Lib/tempfile.py#L741
Python 3.8.2 (default, Apr 8 2020, 14:31:25)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> t = tempfile.TemporaryFile()
>>> print(t.seek(0))
0
>>> u = tempfile.SpooledTemporaryFile()
>>> print(u.seek(0))
None
>>>
----------
components: Library (Lib)
messages: 366475
nosy: amcinnes
priority: normal
severity: normal
status: open
title: SpooledTemporaryFile.seek returns None
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40287>
_______________________________________
More information about the Python-bugs-list
mailing list