diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-06-23 16:06:13 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-06-23 16:06:13 -0400 |
commit | 9df8e18d004cffa7f28429c3f463d2739a2193d0 (patch) | |
tree | ddc9ac0923dbb8e72d0d4d9d85820fe091acf1d7 /Lib/smtplib.py | |
parent | 5c858537e757f95520318c9bd49db7015058cd53 (diff) | |
parent | 600ed6777b2723e52cf7663894801edf79bad32f (diff) | |
download | cpython-9df8e18d004cffa7f28429c3f463d2739a2193d0.tar.gz |
Merge #18179: reflow paragraphs.
Diffstat (limited to 'Lib/smtplib.py')
-rw-r--r-- | Lib/smtplib.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 072b973e0e..80dd46829c 100644 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -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(OSError): """Base class for all exceptions raised by this module.""" class SMTPServerDisconnected(SMTPException): @@ -171,7 +171,7 @@ def _fix_eols(data): try: import ssl -except ImportError: +except ModuleNotFoundError: _have_ssl = False else: _have_ssl = True @@ -311,7 +311,7 @@ class SMTP: try: port = int(port) except ValueError: - raise socket.error("nonnumeric port") + raise OSError("nonnumeric port") if not port: port = self.default_port if self.debuglevel > 0: @@ -332,7 +332,7 @@ class SMTP: s = s.encode("ascii") try: self.sock.sendall(s) - except socket.error: + except OSError: self.close() raise SMTPServerDisconnected('Server not connected') else: @@ -365,7 +365,7 @@ class SMTP: while 1: try: line = self.file.readline() - except socket.error as e: + except OSError as e: self.close() raise SMTPServerDisconnected("Connection unexpectedly closed: " + str(e)) @@ -934,7 +934,7 @@ class LMTP(SMTP): self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self.file = None self.sock.connect(host) - except socket.error: + except OSError: if self.debuglevel > 0: print('connect fail:', host, file=stderr) if self.sock: |