[issue1186900] nntplib shouldn't raise generic EOFError

Berker Peksag report at bugs.python.org
Sun Jul 13 19:56:23 CEST 2014


Berker Peksag added the comment:

diff -r 8f85262fbe8a Lib/nntplib.py
--- a/Lib/nntplib.py	Sun Jul 06 02:24:24 2014 -0400
+++ b/Lib/nntplib.py	Thu Jul 10 16:10:38 2014 -0700
@@ -122,6 +122,9 @@
     """Error in response data"""
     pass
 
+class NNTPConnectError(NNTPError):
+    """Error during connection establishment."""
+    pass

Could you also document the new exception? (See Doc/library/nntplib.rst and please add a versionadded directive)

The pass statement is redundant, but we could keep it to be consistent with rest of the library.


@@ -435,7 +438,7 @@
             raise NNTPDataError('line too long')
         if self.debugging > 1:
             print('*get*', repr(line))
-        if not line: raise EOFError
+        if not line: raise NNTPConnectError()

    if not line:
        raise NNTPConnectError

looks more readable to me.

Also, you could add a more descriptive error message.

----------
nosy: +berker.peksag
versions: +Python 3.5 -Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1186900>
_______________________________________


More information about the Python-bugs-list mailing list