]> granicus.if.org Git - python/commitdiff
SF patch [ 816787 ] urllib2.URLError don't calll IOError.__init__
authorJeremy Hylton <jeremy@alum.mit.edu>
Mon, 6 Oct 2003 05:15:13 +0000 (05:15 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Mon, 6 Oct 2003 05:15:13 +0000 (05:15 +0000)
Not sure if this fix is great, but it's probably a small improvement.

Lib/urllib2.py

index df3729ab80c9e050c75cf276e8dd189c2cf944a2..7124dfb0557db2c86b2d6964dd51ef6086f32ece 100644 (file)
@@ -145,8 +145,12 @@ def install_opener(opener):
 
 class URLError(IOError):
     # URLError is a sub-type of IOError, but it doesn't share any of
-    # the implementation.  need to override __init__ and __str__
+    # the implementation.  need to override __init__ and __str__.
+    # It sets self.args for compatibility with other EnvironmentError
+    # 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):
+        self.args = reason,
         self.reason = reason
 
     def __str__(self):