diff -r d0570cba3749 Lib/nntplib.py --- a/Lib/nntplib.py Sat Jul 26 19:40:16 2014 -0400 +++ b/Lib/nntplib.py Mon Aug 04 19:18:44 2014 -0700 @@ -122,6 +122,9 @@ """Error in response data""" pass +class NNTPConnectError(NNTPError, EOFError): + """Connection closed unexpectedly.""" + pass # Standard port used by NNTP servers NNTP_PORT = 119 @@ -365,7 +368,7 @@ if is_connected(): try: self.quit() - except (OSError, EOFError): + except (OSError, NNTPConnectError): pass finally: if is_connected(): @@ -435,7 +438,8 @@ raise NNTPDataError('line too long') if self.debugging > 1: print('*get*', repr(line)) - if not line: raise EOFError + if not line: + raise NNTPConnectError('Connection is closed.') if strip_crlf: if line[-2:] == _CRLF: line = line[:-2]