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

fix urllib to raise IOError correctly #44365

Closed
dugsong mannequin opened this issue Dec 20, 2006 · 2 comments
Closed

fix urllib to raise IOError correctly #44365

dugsong mannequin opened this issue Dec 20, 2006 · 2 comments
Labels
stdlib Python modules in the Lib dir

Comments

@dugsong
Copy link
Mannequin

dugsong mannequin commented Dec 20, 2006

BPO 1619247
Nosy @birkenfeld
Files
  • urllib.diff: urllib raised IOError fix
  • 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 2006-12-20.08:16:30.000>
    created_at = <Date 2006-12-20.06:42:38.000>
    labels = ['library']
    title = 'fix urllib to raise IOError correctly'
    updated_at = <Date 2006-12-20.08:16:30.000>
    user = 'https://bugs.python.org/dugsong'

    bugs.python.org fields:

    activity = <Date 2006-12-20.08:16:30.000>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2006-12-20.06:42:38.000>
    creator = 'dugsong'
    dependencies = []
    files = ['7673']
    hgrepos = []
    issue_num = 1619247
    keywords = ['patch']
    message_count = 2.0
    messages = ['51585', '51586']
    nosy_count = 2.0
    nosy_names = ['georg.brandl', 'dugsong']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1619247'
    versions = ['Python 2.5']

    @dugsong
    Copy link
    Mannequin Author

    dugsong mannequin commented Dec 20, 2006

    urllib.URLopener's http_error_default() is supposed to raise IOError on failure, but does this with an invalid number of arguments, resulting in a TypeError:

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 357, in http_error_default
    raise IOError('http error', errcode, errmsg, headers)
    TypeError: EnvironmentError expected at most 3 arguments, got 4

    removing the extraneous "headers" argument, the raised exception works as intended:

    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 357, in http_error_default
    raise IOError, ('http error', errcode, errmsg)
    IOError: [Errno http error] 401: 'Unauthorized'

    @dugsong dugsong mannequin closed this as completed Dec 20, 2006
    @dugsong dugsong mannequin added the stdlib Python modules in the Lib dir label Dec 20, 2006
    @dugsong dugsong mannequin closed this as completed Dec 20, 2006
    @dugsong dugsong mannequin added the stdlib Python modules in the Lib dir label Dec 20, 2006
    @birkenfeld
    Copy link
    Member

    Thanks for reporting, this was already fixed in response to bug bpo-1566800.

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant