[New-bugs-announce] [issue16250] URLError invoked with reason as filename

Chris Jerdonek report at bugs.python.org
Tue Oct 16 18:18:13 CEST 2012


New submission from Chris Jerdonek:

This issue is to fix invocations of URLError so that "reasons" are not passed in for the "filename" argument of the URLError constructor.

Ezio found and described this issue when commenting on issue 10836:

  http://bugs.python.org/issue10836#msg172988

In more detail: URLError accepts "reason" and "filename" arguments:

http://hg.python.org/cpython/file/74b95194ba86/Lib/urllib/error.py#l23

However, in several places in Lib/urllib, URLError is invoked with a "reason" passed in for the filename.  For example:

    raise URLError('local file error', 'not on local host')

This issue could be addressed for this example by changing the above to:

    raise URLError('local file error: not on local host')

This dovetails with issue #16247, which is to start passing the actual filename in for some calls to URLError (and perhaps to adjust URLError's __str__, etc).

----------
components: Library (Lib)
keywords: easy
messages: 173058
nosy: chris.jerdonek, ezio.melotti
priority: normal
severity: normal
status: open
title: URLError invoked with reason as filename
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16250>
_______________________________________


More information about the New-bugs-announce mailing list