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.

classification
Title: SpooledTemporaryFile.seek returns None
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amcinnes, methane, miss-islington
Priority: normal Keywords: patch

Created on 2020-04-15 01:41 by amcinnes, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19540 merged methane, 2020-04-15 08:24
PR 19566 merged miss-islington, 2020-04-17 06:56
PR 19567 merged miss-islington, 2020-04-17 06:57
Messages (4)
msg366475 - (view) Author: (amcinnes) Date: 2020-04-15 01:41
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
>>>
msg366643 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-04-17 06:56
New changeset 485e715cb1ff92bc9882cd51ec32589f9cb30503 by Inada Naoki in branch 'master':
bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
https://github.com/python/cpython/commit/485e715cb1ff92bc9882cd51ec32589f9cb30503
msg366644 - (view) Author: miss-islington (miss-islington) Date: 2020-04-17 07:13
New changeset 11ae7d075293fe855c8af26b577656d1026cd9bb by Miss Islington (bot) in branch '3.7':
bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
https://github.com/python/cpython/commit/11ae7d075293fe855c8af26b577656d1026cd9bb
msg366645 - (view) Author: miss-islington (miss-islington) Date: 2020-04-17 07:14
New changeset 9796fe88da7415925b3e8f7e0a5e55301548734f by Miss Islington (bot) in branch '3.8':
bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
https://github.com/python/cpython/commit/9796fe88da7415925b3e8f7e0a5e55301548734f
History
Date User Action Args
2022-04-11 14:59:29adminsetgithub: 84467
2020-04-17 07:15:52methanesetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.7, Python 3.9
2020-04-17 07:14:59miss-islingtonsetmessages: + msg366645
2020-04-17 07:13:38miss-islingtonsetmessages: + msg366644
2020-04-17 06:57:02miss-islingtonsetpull_requests: + pull_request18909
2020-04-17 06:56:56methanesetmessages: + msg366643
2020-04-17 06:56:55miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request18908
2020-04-15 08:24:58methanesetkeywords: + patch
nosy: + methane

pull_requests: + pull_request18888
stage: patch review
2020-04-15 01:41:51amcinnescreate