[Python-checkins] python/dist/src/Lib httplib.py,1.55,1.56

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Sat, 06 Jul 2002 11:55:04 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv4115

Modified Files:
	httplib.py 
Log Message:
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.


Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** httplib.py	6 Jul 2002 18:48:07 -0000	1.55
--- httplib.py	6 Jul 2002 18:55:01 -0000	1.56
***************
*** 890,893 ****
--- 890,895 ----
  
  class HTTPException(Exception):
+     # Subclasses that define an __init__ must call Exception.__init__
+     # or define self.args.  Otherwise, str() will fail.
      pass
  
***************
*** 900,903 ****
--- 902,906 ----
  class UnknownProtocol(HTTPException):
      def __init__(self, version):
+         self.args = version,
          self.version = version
  
***************
*** 910,913 ****
--- 913,917 ----
  class IncompleteRead(HTTPException):
      def __init__(self, partial):
+         self.args = partial,
          self.partial = partial
  
***************
*** 926,929 ****
--- 930,934 ----
  class BadStatusLine(HTTPException):
      def __init__(self, line):
+         self.args = line,
          self.line = line
  
***************
*** 1074,1077 ****
--- 1079,1083 ----
      except BadStatusLine, err:
          print "strict mode failed as expected"
+         print err
      else:
          print "XXX strict mode should have failed"