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

Some SocketIO methods can succeed after close() #60046

Closed
pitrou opened this issue Sep 1, 2012 · 6 comments
Closed

Some SocketIO methods can succeed after close() #60046

pitrou opened this issue Sep 1, 2012 · 6 comments
Labels
stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Sep 1, 2012

BPO 15842
Nosy @pitrou, @benjaminp, @hynek
Files
  • socket.patch: patch
  • socket.patch: patch
  • 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 2012-09-14.15:34:51.093>
    created_at = <Date 2012-09-01.19:20:12.733>
    labels = ['type-bug', 'library', 'expert-IO']
    title = 'Some SocketIO methods can succeed after close()'
    updated_at = <Date 2012-09-14.15:34:51.092>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2012-09-14.15:34:51.092>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-09-14.15:34:51.093>
    closer = 'pitrou'
    components = ['Library (Lib)', 'IO']
    creation = <Date 2012-09-01.19:20:12.733>
    creator = 'pitrou'
    dependencies = []
    files = ['27128', '27149']
    hgrepos = []
    issue_num = 15842
    keywords = ['patch']
    message_count = 6.0
    messages = ['169666', '169883', '170057', '170068', '170478', '170479']
    nosy_count = 6.0
    nosy_names = ['pitrou', 'benjamin.peterson', 'stutzbach', 'python-dev', 'hynek', 'eng793']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue15842'
    versions = ['Python 3.2', 'Python 3.3']

    @pitrou
    Copy link
    Member Author

    pitrou commented Sep 1, 2012

    >>> import socket
    >>> s = socket.socket()
    >>> f = s.makefile("rb", buffering=0)
    >>> f
    <socket.SocketIO object at 0x7f2f323cd790>
    >>> f.close()
    >>> f.writable()
    False
    >>> f.readable()
    False

    @pitrou pitrou added stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error labels Sep 1, 2012
    @eng793
    Copy link
    Mannequin

    eng793 mannequin commented Sep 5, 2012

    This patch fixes the problem, making those methods raise a ValueError exception after close.

    I also added one test case for this issue.

    @pitrou
    Copy link
    Member Author

    pitrou commented Sep 8, 2012

    Actually, I've found a couple of issues with the patch:

    • it doesn't address seekable(); seekable() should also raise ValueError
    • the test should be done with makefile(..., buffering=0), so that SocketIO is actually tested, rather than the buffered object wrapping it

    @eng793
    Copy link
    Mannequin

    eng793 mannequin commented Sep 8, 2012

    Fixed seekable(), and amended tests; see patch.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 14, 2012

    New changeset fad797916266 by Antoine Pitrou in branch '3.2':
    Issue bpo-15842: the SocketIO.{readable,writable,seekable} methods now raise ValueError when the file-like object is closed.
    http://hg.python.org/cpython/rev/fad797916266

    New changeset 3b0e20f71d8a by Antoine Pitrou in branch 'default':
    Issue bpo-15842: the SocketIO.{readable,writable,seekable} methods now raise ValueError when the file-like object is closed.
    http://hg.python.org/cpython/rev/3b0e20f71d8a

    @pitrou
    Copy link
    Member Author

    pitrou commented Sep 14, 2012

    Ok, I've committed the patch. Thanks Alessandro!

    @pitrou pitrou closed this as completed Sep 14, 2012
    @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
    stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant