Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e50b69

Browse files
committed
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.
1 parent 5248a2d commit 6e50b69

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/email/errors.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class MessageDefect(ValueError):
3434
"""Base class for a message defect."""
3535

3636
def __init__(self, line=None):
37+
if line is not None:
38+
super().__init__(line)
3739
self.line = line
3840

3941
class NoBoundaryInMultipartDefect(MessageDefect):
@@ -76,6 +78,9 @@ class InvalidBase64CharactersDefect(MessageDefect):
7678
class HeaderDefect(MessageDefect):
7779
"""Base class for a header defect."""
7880

81+
def __init__(self, *args, **kw):
82+
super().__init__(*args, **kw)
83+
7984
class InvalidHeaderDefect(HeaderDefect):
8085
"""Header is not valid, message gives details."""
8186

0 commit comments

Comments
 (0)