Martin Panter added the comment: Well with a regular BufferedWriter, the chained exception is the same type as the original exception, so it does not really matter. I was just using the out-of-space exception as an easy way to get the body() method to abort in the middle of a command.
The problem with the NNTP library is that the NNTP class assumes that it can send a QUIT command when it shouldn’t be. The result can be a giant error message full of apparent garbage data, rather like in Issue 21468. The minimum behaviour that I expect is that when the context manager exits, it should not cause a double exception with a different error type. My patch closes the connection as soon as an unrecoverable error happens, so __exit__() will not send a QUIT command and receive an invalid response. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22350> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com