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

nntplib.NNTP should support the context protocol #54004

Closed
pitrou opened this issue Sep 7, 2010 · 6 comments
Closed

nntplib.NNTP should support the context protocol #54004

pitrou opened this issue Sep 7, 2010 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@pitrou
Copy link
Member

pitrou commented Sep 7, 2010

BPO 9795
Nosy @pitrou, @giampaolo
Files
  • nntplib-context-manager.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 = 'https://github.com/giampaolo'
    closed_at = <Date 2011-03-03.18:34:25.289>
    created_at = <Date 2010-09-07.22:42:54.033>
    labels = ['type-feature', 'library']
    title = 'nntplib.NNTP should support the context protocol'
    updated_at = <Date 2011-03-03.18:34:25.288>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2011-03-03.18:34:25.288>
    actor = 'giampaolo.rodola'
    assignee = 'giampaolo.rodola'
    closed = True
    closed_date = <Date 2011-03-03.18:34:25.289>
    closer = 'giampaolo.rodola'
    components = ['Library (Lib)']
    creation = <Date 2010-09-07.22:42:54.033>
    creator = 'pitrou'
    dependencies = []
    files = ['20894']
    hgrepos = []
    issue_num = 9795
    keywords = ['patch']
    message_count = 6.0
    messages = ['115815', '115818', '129420', '129510', '129542', '129993']
    nosy_count = 2.0
    nosy_names = ['pitrou', 'giampaolo.rodola']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue9795'
    versions = ['Python 3.3']

    @pitrou
    Copy link
    Member Author

    pitrou commented Sep 7, 2010

    As the title says. __exit__() simply has to call self.quit(), AFAICT.

    @pitrou pitrou added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Sep 7, 2010
    @giampaolo
    Copy link
    Contributor

    Assigning this to me.
    Hopefully this should go into the plan of adding a context manager to all network libs (ftplib, smptlib, imaplib, etc..) in time for Python 3.2.

    @giampaolo giampaolo self-assigned this Sep 7, 2010
    @giampaolo
    Copy link
    Contributor

    Patch in attachment.

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 26, 2011

    Not sure that silencing errors from quit() is the right thing. Is there any reason?

    @giampaolo
    Copy link
    Contributor

    (socket.error, EOFError) after quit() indicates that the socket is disconnected, in which case we should not raise any error (or at least, this is the approach we're using in ftplib) while all other NNTPError related errors are not suppressed.

    @giampaolo
    Copy link
    Contributor

    Committed in r88734.

    @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 type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants