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

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

Closed
denkoren mannequin opened this issue Jul 29, 2013 · 2 comments
Closed

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

denkoren mannequin opened this issue Jul 29, 2013 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@denkoren
Copy link
Mannequin

denkoren mannequin commented Jul 29, 2013

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

    @denkoren
    Copy link
    Mannequin Author

    denkoren mannequin commented Jul 29, 2013

    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: ...'

    @denkoren denkoren mannequin added the type-bug An unexpected behavior, bug, or error label Jul 29, 2013
    @bitdancer
    Copy link
    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.

    @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
    type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant