]> granicus.if.org Git - python/commitdiff
Now that Defects are Exception subclasses, call super.
authorR David Murray <rdmurray@bitdance.com>
Sat, 9 Jun 2012 02:45:46 +0000 (22:45 -0400)
committerR David Murray <rdmurray@bitdance.com>
Sat, 9 Jun 2012 02:45:46 +0000 (22:45 -0400)
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.

Lib/email/errors.py

index d80b5b93b5837227de938352e7ced3f68966b2e8..791239fa6a54cc0a826d1c53df8c42cba5a9619c 100644 (file)
@@ -34,6 +34,8 @@ class MessageDefect(ValueError):
     """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 InvalidBase64CharactersDefect(MessageDefect):
 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."""