[issue22350] nntplib file write failure causes exception from QUIT command

2015-05-25 Thread Martin Panter
Martin Panter added the comment: For the record, the SMTP scenario was Issue 17498, where code that is about to raise an exception attempts an RSET command that could also fail. I do think each change in my patch is essentially the same case: restoring the invariant expected by the __exit__()

[issue22350] nntplib file write failure causes exception from QUIT command

2015-04-02 Thread R. David Murray
R. David Murray added the comment: That's fine, but you need to look at each case individually, and not try to deal with them as if they were all the same. This is because you want the correct error to percolate up. For example, in smtplib we have a case where the server may respond to a

[issue22350] nntplib file write failure causes exception from QUIT command

2015-04-01 Thread Martin Panter
Martin Panter added the comment: Serhiy, regarding _getresp() calling resp.decode(): You are probably right that a failure decoding the response line is recoverable in some circumstances, such a GROUP command. But in other cases, say an ARTICLE command, the response won’t have been fully

[issue22350] nntplib file write failure causes exception from QUIT command

2015-03-22 Thread Martin Panter
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

[issue22350] nntplib file write failure causes exception from QUIT command

2015-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But the same issue exists with regular files. with open('/dev/full', 'wb') as f: ... f.write(b'x'*1) ... Traceback (most recent call last): File stdin, line 2, in module OSError: [Errno 28] No space left on device And using Python implementation

[issue22350] nntplib file write failure causes exception from QUIT command

2015-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I doubt that it is good idea to close connection on *any* error. For example in _getresp() resp.decode() can raise an exception, but this failure isn't related to the ability of sending QUIT and other commands. Sample error handling in your first message

[issue22350] nntplib file write failure causes exception from QUIT command

2015-03-22 Thread R. David Murray
R. David Murray added the comment: It looks to be clearly the case that there needs to be some error handling code wrapped around the file write in _getlongresp. Your patch doesn't do just that, however, so it seems like there may be other errors you are also worried about? Can you explain

[issue22350] nntplib file write failure causes exception from QUIT command

2015-02-28 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22350 ___

[issue22350] nntplib file write failure causes exception from QUIT command

2014-12-23 Thread Jakub Wilk
Changes by Jakub Wilk jw...@jwilk.net: -- nosy: +jwilk ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22350 ___ ___ Python-bugs-list mailing list

[issue22350] nntplib file write failure causes exception from QUIT command

2014-12-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +pitrou stage: - patch review type: - behavior versions: +Python 2.7, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22350

[issue22350] nntplib file write failure causes exception from QUIT command

2014-12-18 Thread Martin Panter
Martin Panter added the comment: Here is a patch with a fix and a test -- keywords: +patch Added file: http://bugs.python.org/file37501/fail-close.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22350

[issue22350] nntplib file write failure causes exception from QUIT command

2014-09-06 Thread Martin Panter
New submission from Martin Panter: The following code triggers an NNTPProtocolError, as long as the body is large enough to cause an intermediate flush of the output file. The reason I think is that the body() method aborts in the middle of reading the BODY response, and when the context