[Python-Dev] urllib exception compatibility
Guido van Rossum
guido at python.org
Thu Sep 27 03:52:45 CEST 2007
Shouldn't these all inherit from EnvironmentError?
Or should EnvironmentError and IOError be the same thing perhaps?
On 9/26/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> urllib goes to goes to some trouble to ensure that it raises IOError,
> even when the underlying exception comes from another module.[*] I'm
> wondering if it would make sense to just have those modules'
> exceptions inherit from IOError.
> In particular, should socket.error, ftp.Error and
> httplib.HTTPException (used in Py3K) inherit from IOError?
> I'm also wondering whether it would be acceptable to change the
> details of the exceptions. For example, could
> raise IOError, ('ftp error', msg), sys.exc_info()
> be reworded, or is there there too much risk that someone is checking
> for an "errno" of 'ftp error'?
> [*] This isn't a heavily tested path; some actually fail with a
> TypeError since 2.5, because IOError no longer accepts argument tuples
> longer than 3. http://bugs.python.org/issue1209 Fortunately, this
> makes me less worried about changing the contents of the specific
> attributes to something more useful...
> Python-Dev mailing list
> Python-Dev at python.org
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev