diff -r deb421baf671 Lib/urllib/error.py --- a/Lib/urllib/error.py Sat Jul 28 21:59:05 2012 +0200 +++ b/Lib/urllib/error.py Sat Jul 28 22:49:13 2012 -0400 @@ -27,8 +27,12 @@ # subclasses, but args doesn't have the typical format with errno in # slot 0 and strerror in slot 1. This may be better than nothing. def __init__(self, reason, filename=None): - self.args = reason, + self.args = (reason,) self.reason = reason + if hasattr(reason, "errno"): + self.errno = reason.errno + if hasattr(reason, "strerror"): + self.strerror = reason.strerror if filename is not None: self.filename = filename