[issue1422] Writing to an invalid fd doesn't raise an exception

Christian Heimes report at bugs.python.org
Sun Nov 11 20:49:58 CET 2007


Christian Heimes added the comment:

Python 2.5 and probably 2.6 suffer from the same problem although it's
harder to trigger it.

Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> f = open("/tmp/test", 'w')
>>> f.fileno()
3
>>> os.close(f.fileno())
>>> f.write("test")
>>> f.write("test")
>>>
close failed: [Errno 9] Bad file descriptor
$ ls -la /tmp/test
-rw-r----- 1 heimes heimes 0 2007-11-11 20:46 /tmp/test

----------
versions: +Python 2.5, Python 2.6

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1422>
__________________________________


More information about the Python-bugs-list mailing list