[issue17976] file.write doesn't raise IOError when it should

Jaakko Moisio report at bugs.python.org
Wed May 15 11:04:58 CEST 2013


Jaakko Moisio added the comment:

I tried to reply to the review of my last patch but this tracker software itself crashed. Is there anyone who would be interested in the traceback?

Anyway, I'll reply here.

On 2013/05/15 08:37:29, Charles-François Natali wrote:
> http://bugs.python.org/review/17976/diff/8158/Objects/fileobject.c
> File Objects/fileobject.c (right):
> 
> http://bugs.python.org/review/17976/diff/8158/Objects/fileobject.c#newcode1856
> Objects/fileobject.c:1856: if (n2 != n || errno != 0) {
> Hum, we saw that ferror() could be used to detect the error, so it should be
> used instead.
> 
> Also, there's a problem with this patch: it's checking errno too late: for
> example, it could have been cleared by FILE_END_ALLOW_THREADS or Py_XDECREF in
> the meantime.

Ok. However I must point out that if errno is cleared in the meantime, that also affects PyErr_SetFromErrno. I've submitted another patch where I'm extra careful with errno.

----------

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


More information about the Python-bugs-list mailing list