diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-07-06 18:55:01 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-07-06 18:55:01 (GMT) |
commit | 12f4f35f6e675bbe7435069ab7516a48e82f27a9 (patch) | |
tree | ecf84c90c45abbe63b9c25dcf8254837cfbcd349 /Lib | |
parent | d46aa37d35811a37397104f02074c8a44e7dbec1 (diff) | |
download | cpython-12f4f35f6e675bbe7435069ab7516a48e82f27a9.zip cpython-12f4f35f6e675bbe7435069ab7516a48e82f27a9.tar.gz cpython-12f4f35f6e675bbe7435069ab7516a48e82f27a9.tar.bz2 |
Fix SF bug #575360
Subclasses of Exception that define an __init__ must call
Exception.__init__ or define self.args. Otherwise, str() will fail.
Bug fix candidate.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/httplib.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index b3b9915..41eb3b0 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -889,6 +889,8 @@ if hasattr(socket, 'ssl'): class HTTPException(Exception): + # Subclasses that define an __init__ must call Exception.__init__ + # or define self.args. Otherwise, str() will fail. pass class NotConnected(HTTPException): @@ -899,6 +901,7 @@ class InvalidURL(HTTPException): class UnknownProtocol(HTTPException): def __init__(self, version): + self.args = version, self.version = version class UnknownTransferEncoding(HTTPException): @@ -909,6 +912,7 @@ class UnimplementedFileMode(HTTPException): class IncompleteRead(HTTPException): def __init__(self, partial): + self.args = partial, self.partial = partial class ImproperConnectionState(HTTPException): @@ -925,6 +929,7 @@ class ResponseNotReady(ImproperConnectionState): class BadStatusLine(HTTPException): def __init__(self, line): + self.args = line, self.line = line # for backwards compatibility @@ -1073,6 +1078,7 @@ def test(): r = c.getresponse() except BadStatusLine, err: print "strict mode failed as expected" + print err else: print "XXX strict mode should have failed" |