[Python-checkins] cpython: Now that Defects are Exception subclasses, call super.

r.david.murray python-checkins at python.org
Sat Jun 9 04:46:33 CEST 2012


http://hg.python.org/cpython/rev/10a8ad665749
changeset:   77391:10a8ad665749
user:        R David Murray <rdmurray at bitdance.com>
date:        Fri Jun 08 22:45:46 2012 -0400
summary:
  Now that Defects are Exception subclasses, call super.

The behavior of MessageDefect is legacy behavior.  The chances anyone is
actually using the undocumented 'line' attribute is low, but it costs
little to retain backward compatibility.  Although one of the costs is
having to restore normal exception behavior in HeaderDefect.  On the
other hand, I'll probably add some specialized behavior there later.

files:
  Lib/email/errors.py |  5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Lib/email/errors.py b/Lib/email/errors.py
--- a/Lib/email/errors.py
+++ b/Lib/email/errors.py
@@ -34,6 +34,8 @@
     """Base class for a message defect."""
 
     def __init__(self, line=None):
+        if line is not None:
+            super().__init__(line)
         self.line = line
 
 class NoBoundaryInMultipartDefect(MessageDefect):
@@ -76,6 +78,9 @@
 class HeaderDefect(MessageDefect):
     """Base class for a header defect."""
 
+    def __init__(self, *args, **kw):
+        super().__init__(*args, **kw)
+
 class InvalidHeaderDefect(HeaderDefect):
     """Header is not valid, message gives details."""
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list