[issue5544] test_fileio fails on windows MSVC Assertion

Antoine Pitrou report at bugs.python.org
Mon Mar 23 22:05:43 CET 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

It is not strictly speaking "an error" which is causing the double
close... It's the deliberate behaviour of a test I have added to check
that errno is correctly set on the raised IOError when calling close()
on a FileIO object whose handle has already been closed manually (with
os.close()).

In other words, since it is possible to retrieve the file descriptor of
an IO object using the fileno() method (and, moreover, it is possible to
give an existing file descriptor to the open() function so as to wrap it
inside an IO object), access to a closed file is always possible and
should be protected against (that is, it raises an IOError with the
errno attribute equal to EBADF).

----------

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


More information about the Python-bugs-list mailing list