Skip to content

urllib raises exception with string in 'errno' attribute #62787

Closed

Description

@denkoren
mannequin
BPO 18587
Nosy @bitdancer
Superseder
  • bpo-6471: errno and strerror attributes incorrectly set on socket errors wrapped by urllib
  • Files
  • pyerror.py: Bug demonstration code example.
  • 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 2013-07-29.17:16:38.664>
    created_at = <Date 2013-07-29.16:01:57.871>
    labels = ['type-bug']
    title = "urllib raises exception with string in 'errno' attribute"
    updated_at = <Date 2013-07-29.17:16:38.661>
    user = 'https://bugs.python.org/denkoren'

    bugs.python.org fields:

    activity = <Date 2013-07-29.17:16:38.661>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-07-29.17:16:38.664>
    closer = 'r.david.murray'
    components = []
    creation = <Date 2013-07-29.16:01:57.871>
    creator = 'denkoren'
    dependencies = []
    files = ['31075']
    hgrepos = []
    issue_num = 18587
    keywords = []
    message_count = 2.0
    messages = ['193878', '193883']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'denkoren']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '6471'
    type = 'behavior'
    url = 'https://bugs.python.org/issue18587'
    versions = ['Python 2.7']

    Activity

    1. denkoren commented on Jul 29, 2013

      denkorenmannequin
      MannequinAuthor

      On 'connection refused' error urllib creates IOError with wrong arguents:
      args ('socket error', error(<os-dependent-number>, 'Connection refused'))

      It results to dirty hacks in Python code like
      'if e.errno == "socket error": ...'

      instead of traditional

      'id e.errno == errno.ECONNREFUSED: ...'

    2. bitdancer commented on Jul 29, 2013

      @bitdancer
      Member

      This is a duplicate of bpo-6471, which we really do need to fix. But there are backward compatibility concerns with fixing it in 2.7, I'm afraid.

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

      type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions