Skip to content

smptlib.py can raise socket.error #49179

Closed

Description

@kristjanvalur
BPO 4929
Nosy @kristjanvalur, @vstinner, @giampaolo
Files
  • smtplib.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 2009-01-15.17:28:13.986>
    created_at = <Date 2009-01-13.11:31:16.322>
    labels = ['type-bug', 'library']
    title = 'smptlib.py can raise socket.error'
    updated_at = <Date 2009-01-19.10:38:31.546>
    user = 'https://github.com/kristjanvalur'

    bugs.python.org fields:

    activity = <Date 2009-01-19.10:38:31.546>
    actor = 'kristjan.jonsson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-01-15.17:28:13.986>
    closer = 'kristjan.jonsson'
    components = ['Library (Lib)']
    creation = <Date 2009-01-13.11:31:16.322>
    creator = 'kristjan.jonsson'
    dependencies = []
    files = ['12716']
    hgrepos = []
    issue_num = 4929
    keywords = ['patch', 'needs review']
    message_count = 7.0
    messages = ['79732', '79765', '79798', '79882', '79883', '79904', '80156']
    nosy_count = 4.0
    nosy_names = ['ggenellina', 'kristjan.jonsson', 'vstinner', 'giampaolo.rodola']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue4929'
    versions = ['Python 2.6', 'Python 2.5', 'Python 2.7']

    Activity

    1. kristjanvalur commented on Jan 13, 2009

      kristjanvalurmannequin
      MannequinAuthor

      the SMPT.getreply() method doesn't check for socket.error when doing its
      readline() call. We now check for connection reset and others that can
      occur here and properly close. This is to comply with the documentation
      that doesn't specify socket.error as part of the exceptions raised.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jan 13, 2009
    3. vstinner commented on Jan 13, 2009

      @vstinner
      Member

      Your patch looks fine but it would be much better with a test in
      Lib/test/test_smtp.py ;-)

    4. kristjanvalur commented on Jan 13, 2009

      kristjanvalurmannequin
      MannequinAuthor

      If you can offer a suggestion as to how to reliably trigger a
      WSAECONNRESET error on windows (or its equivalent on unix) I'll be
      happy to do that.

    5. ggenellina commented on Jan 15, 2009

      ggenellinamannequin
      Mannequin

      On Windows, if you exit a process abnormally (using e.g. os._exit() in
      Python) while it still has open connections, the other side receives a
      WSAECONNRESET (error 10054).

      So, you could write a test case using a dumb server (running as another
      process) with a very short, predefined sequence of recv/send calls,
      ending abruptly with os._exit().

      On Linux I *think* you would get ECONNRESET, and at least some form of
      error on other OS's.

    6. giampaolo commented on Jan 15, 2009

      @giampaolo
      Contributor

      IMHO I wouldn't test such case.
      Behaviors between different platform are unpredictable.

    7. kristjanvalur commented on Jan 15, 2009

      kristjanvalurmannequin
      MannequinAuthor

      Submitted as r68618

    8. kristjanvalur commented on Jan 19, 2009

      kristjanvalurmannequin
      MannequinAuthor

      Note, this has been ported to py3k in http://svn.python.org/view?
      view=rev&rev=68736

    9. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions