]> granicus.if.org Git - python/commitdiff
#2118: Make SMTPException a subclass of IOError.
authorR David Murray <rdmurray@bitdance.com>
Sat, 13 Apr 2013 18:49:48 +0000 (14:49 -0400)
committerR David Murray <rdmurray@bitdance.com>
Sat, 13 Apr 2013 18:49:48 +0000 (14:49 -0400)
Initial patch by Ned Jackson Lovely.

Doc/library/smtplib.rst
Doc/whatsnew/3.4.rst
Lib/smtplib.py
Misc/NEWS

index 9593dea8116697adc0361257e27bbc853c6e5e3d..04036dce4c0ab527cc58e14322bb6d48857ac356 100644 (file)
@@ -103,8 +103,8 @@ A nice selection of exceptions is defined as well:
 
 .. exception:: SMTPException
 
-   The base exception class for all the other excpetions provided by this
-   module.
+   Subclass of :exc:`IOError` that is the base exception class for all
+   the other excpetions provided by this module.
 
 
 .. exception:: SMTPServerDisconnected
index 75ac8ba6eb36e2aee01fdf581a4532a92da371c8..2b6193a215242b206ba00d9c09154babed7842b8 100644 (file)
@@ -151,12 +151,23 @@ New Modules
 Improved Modules
 ================
 
+
 doctest
 -------
 
 Added ``FAIL_FAST`` flag to halt test running as soon as the first failure is
 detected.  (Contributed by R. David Murray and Daniel Urban in :issue:`16522`.)
 
+
+smtplib
+-------
+
+:exc:`~smtplib.SMTPException` is now a subclass of :exc:`IOError`, which allows
+both socket level errors and SMTP protocol level errors to be caught in one
+try/except statement by code that only cares whether or not an error occurred.
+(:issue:`2118`).
+
+
 wave
 ----
 
index 50a087c19b17fde98066669ae8c02dcfab83948e..a5a9fd4c8de3d1c17a74b11078c5bcf0c3212b46 100644 (file)
@@ -66,7 +66,7 @@ bCRLF = b"\r\n"
 OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I)
 
 # Exception classes used by this module.
-class SMTPException(Exception):
+class SMTPException(IOError):
     """Base class for all exceptions raised by this module."""
 
 class SMTPServerDisconnected(SMTPException):
index c1634939f0822b3c8805125250ede37343e3868d..c6188de24b0d8afc8cb2874c3e3be39a106f9757 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #2118: SMTPException is now a subclass of IOError.
+
 - Issue #17016: Get rid of possible pointer wraparounds and integer overflows
   in the re module.  Patch by Nickolai Zeldovich.