Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpooledTemporaryFile.seek returns None #84467

Closed
amcinnes mannequin opened this issue Apr 15, 2020 · 4 comments
Closed

SpooledTemporaryFile.seek returns None #84467

amcinnes mannequin opened this issue Apr 15, 2020 · 4 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@amcinnes
Copy link
Mannequin

amcinnes mannequin commented Apr 15, 2020

BPO 40287
Nosy @methane, @miss-islington
PRs
  • bpo-40287: Fix SpooledTemporaryFile.seek() return value #19540
  • [3.8] bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540) #19566
  • [3.7] bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540) #19567
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-04-17.07:15:52.468>
    created_at = <Date 2020-04-15.01:41:51.263>
    labels = ['3.7', '3.8', 'type-bug', 'library', '3.9']
    title = 'SpooledTemporaryFile.seek returns None'
    updated_at = <Date 2020-04-17.07:15:52.460>
    user = 'https://bugs.python.org/amcinnes'

    bugs.python.org fields:

    activity = <Date 2020-04-17.07:15:52.460>
    actor = 'methane'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-17.07:15:52.468>
    closer = 'methane'
    components = ['Library (Lib)']
    creation = <Date 2020-04-15.01:41:51.263>
    creator = 'amcinnes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40287
    keywords = ['patch']
    message_count = 4.0
    messages = ['366475', '366643', '366644', '366645']
    nosy_count = 3.0
    nosy_names = ['methane', 'miss-islington', 'amcinnes']
    pr_nums = ['19540', '19566', '19567']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40287'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @amcinnes
    Copy link
    Mannequin Author

    amcinnes mannequin commented Apr 15, 2020

    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

    self._file.seek(*args)

    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
    >>>

    @amcinnes amcinnes mannequin added 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 15, 2020
    @methane
    Copy link
    Member

    methane commented Apr 17, 2020

    New changeset 485e715 by Inada Naoki in branch 'master':
    bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
    485e715

    @miss-islington
    Copy link
    Contributor

    New changeset 11ae7d0 by Miss Islington (bot) in branch '3.7':
    bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
    11ae7d0

    @miss-islington
    Copy link
    Contributor

    New changeset 9796fe8 by Miss Islington (bot) in branch '3.8':
    bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
    9796fe8

    @methane methane added 3.7 (EOL) end of life 3.9 only security fixes labels Apr 17, 2020
    @methane methane closed this as completed Apr 17, 2020
    @methane methane added 3.7 (EOL) end of life 3.9 only security fixes labels Apr 17, 2020
    @methane methane closed this as completed Apr 17, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants